View source: R/Harmonization_function.R
harmonization | R Documentation |
This is the main function in the psHarmonize package. Takes a harmonization sheet as input, and returns a harmonization object (list with S3 class of 'psHarmonize'). Requires source data.frames to be in the global environment.
harmonization(
harmonization_sheet,
long_dataset = TRUE,
wide_dataset = TRUE,
error_log = TRUE,
source_variables = TRUE,
na_string = "NA",
verbose = TRUE
)
harmonization_sheet |
Harmonization sheet input. Set of coding instructions |
long_dataset |
(TRUE/FALSE) Should the function return a long dataset? |
wide_dataset |
(TRUE/FALSE) Should the function return a wide dataset? |
error_log |
(TRUE/FALSE) Should the function return an error log? |
source_variables |
(TRUE/FALSE) Should the output datasets contain the original non modified values? |
na_string |
Character string of final recode value to be set to missing.
Default is 'NA'. For example, if you use |
verbose |
(TRUE/FALSE) Should the |
Note: psHarmonize evaluates and runs code entered in the harmonization sheet. Make sure to only use harmonization sheets from authors you trust.
List of return objects with S3 class of 'psHarmonize'. Can be used
as input for report function create_summary_report()
and
create_error_log_report()
.
# Running harmonization function with example harmonization sheet
harmonization_obj <- harmonization(harmonization_sheet = harmonization_sheet_example)
# Extracting harmonized long dataset (each row is a visit)
long_dataset <- harmonization_obj$long_dataset
# Extracting harmonized wide dataset (each row is a person)
# Visits are expressed in multiple columns
wide_dataset <- harmonization_obj$wide_dataset
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.