likert5.recode | R Documentation |
This function can be used to quickly recode variables that use 5 points likert scale
likert5.recode(df, vars.to.recode, invert = FALSE, new.levels = NULL)
df |
a data.frame |
vars.to.recode |
a string vector with the names of the variables to recode |
invert |
boolean, indicates if the values of the new variable should be inverted |
new.levels |
a string vector with the name of the new categories |
The function returns the data frame with 6 new variables named <vars.to.recode>5 (numerical variable with 5 levels from 1 to 5),<vars.to.recode>5c (factor with 5 levels), <vars.to.recode>3 (numerical variable with 3 levels, -1, 0, and 1), <vars.to.recode>3c (3 levels categorical variable), <vars.to.recode>2 (2 levels numerical variable), <vars.to.recode>2c (two levels categorical variable).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.