knitr::opts_chunk$set(echo = TRUE, collapse = TRUE, comment = "#>")
source("../R/test_data_generator.R")

What is the function rec_with_table?

rec_with_table is the function used to recode variables within your dataset into harmonized variables. rec_with_table reads:

library(recodeflow)
status <- rec_with_table(data = tester1, 
                         variables = "status", 
                         variable_details = variable_details,
                         log = TRUE,
                         var_labels = c(status = "Status"))

Output - Warning messages

Warning messages will appear when your dataset is missing variables in your variable worksheet or rec_with_table() call.

Output - Notes

By default, rec_with_table() prints notes to the console.

Notes can give important details on what and how variables are harmonized. For example, notes can include details on:

You should read and consider notes before deciding whether to harmonize a variable.

The notes output is from the column notes in variable_details

Arguments - Required

#To recode only a few variables
age_sex_1 <- rec_with_table(data = tester1, 
                         variables = c("age","sex"),
                         variable_details = variable_details)


#To recode all variables listed on the variable worksheet
recoded1 <- rec_with_table(data = tester1,
                          variables = variables,
                          variable_details = variable_details)

Arguments - Default

With rec_with_table() the following arguments are only called if you want to modify them.



Big-Life-Lab/recodeflow documentation built on Jan. 19, 2024, 10:41 p.m.