View source: R/create_long_dataset.R
create_long_dataset | R Documentation |
This function is usually not called by the user. Instead it is usually
called by harmonization()
function.
create_long_dataset(
vars_interest,
subdomain,
previous_dataset,
error_log,
na_string,
verbose = TRUE
)
vars_interest |
Variable currently being harmonized |
subdomain |
Category of variable |
previous_dataset |
Dataframe created so far |
error_log |
Error log |
na_string |
Character string of final recode value to be set to NA. |
verbose |
(TRUE/FALSE) Should the function print the current progress to the console? |
The function takes the harmonization sheet, and input dataframe, and creates a dataframe with the harmonized variable.
Returns a list with the harmonized long dataset, and error log.
# Example sheet
test_sheet <- harmonization_sheet_example[harmonization_sheet_example$study == 'Cohort A',]
# Example dataset
test_data <- cohort_a
# create error log
test_error_log <- test_sheet[,c('item','study','visit','possible_range')]
test_error_log$completed_status <- NA_character_
test_error_log$completed_reason <- NA_character_
test_error_log$range_set_to_na <- NA_integer_
test_error_log$range_out_of_range_warning <- NA
long_dataset <- create_long_dataset(vars_interest = test_sheet,
subdomain = 'age',
previous_dataset = test_data,
error_log = test_error_log,
na_string = 'NA',
verbose = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.