secuTrial can return a codebook of codes and labels for categorical variables, including lookup
type variables, if this option is selected in the export tool ('reference values as separate table').
This allows factors to be easily created. Factorize methods exist for secuTrialdata
objects,
data.frames
, integer
s and logical
s, but the intent is that only the former be
used by users. The other methods could be used with customized codebooks.
factorize_secuTrial(object, ...)
# S3 method for secuTrialdata
factorize_secuTrial(object, ...)
secuTrialdata
object with additional factor variables in study forms containing categorical data
further parameters
factorized secuTrialdata
object
factorize_secuTrial will return an error if the appropriate codebook is not available.
# load secuTrial export with separate reference table
sT_export <- read_secuTrial_raw(system.file("extdata", "sT_exports", "lnames",
"s_export_CSV-xls_CTU05_long_ref_miss_en_utf8.zip",
package = "secuTrialR"))
# factorize the secuTrialdata object
sT_export_factorized <- factorize_secuTrial(sT_export)