knitr::opts_chunk$set(echo = TRUE, collapse = TRUE, comment = "#>")

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 = recodeflow::pbc, 
                         variables = "status", 
                         variable_details = recodeflow::pbc_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 = recodeflow::pbc, 
                         variables = c("age","sex"),
                         variable_details = recodeflow::pbc_variable_details)


#To recode all variables listed on the variable worksheet
recoded1 <- rec_with_table(data = recodeflow::pbc,
                           variables = recodeflow::pbc_variables,
                           variable_details = recodeflow::pbc_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 April 3, 2025, 2:02 p.m.