| autoRecode | R Documentation |
GADSdat.Auto recode a variable in a GADSdat. A look up table is created containing the respective recode pairs.
An existing look up table can be utilized via template. This function somewhat mirrors the functionality provided
by the SPSS function autorecode.
autoRecode(
GADSdat,
var,
var_suffix = "",
label_suffix = "",
csv_path = NULL,
template = NULL
)
GADSdat |
A |
var |
Character string of the variable name which should be recoded. |
var_suffix |
Variable suffix for the newly created |
label_suffix |
Suffix added to variable label for the newly created variable in the |
csv_path |
Path for the |
template |
Existing look up table. |
If an existing template is used and a look up table is saved as a .csv file, the resulting look up
table will contain the existing recodes plus additional recode pairs required for the data.
Returns a GADSdat object.
gads <- import_DF(data.frame(v1 = letters))
# auto recode without saving look up table
gads2 <- autoRecode(gads, var = "v1", var_suffix = "_num")
# auto recode with saving look up table
f <- tempfile(fileext = ".csv")
gads2 <- autoRecode(gads, var = "v1", var_suffix = "_num", csv_path = f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.