fct2num | R Documentation |
Converts a factor to a numeric vector while adjusting for the starting value of the numeric vector. Useful for converting from categorical responses (e.g. "Agree","Disagree") to numeric (1,2).
fct2num(factor_vector, start = 1, print = "message")
factor_vector |
A vector that is a factor. |
start |
Defaults to 1. The starting value of the resultant numeric vector. The value inputted for |
print |
Defaults to "message". Determines if the text messages of this function uses |
a <- factor(c("Agree","Disagree","Agree","Agree","Disagree"))
fct2num(a)
fct2num(a, start = 0) # if likert scales begin at 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.