Description Usage Arguments Examples
Reverse the levels of a factor.
1 |
x |
a factor or a data.frame of factors whose levels will be reverse coded. |
1 2 3 | mylevels <- c('Strongly Disagree', 'Disagree', 'Neither', 'Agree', 'Strongly Agree')
test <- factor(sample(mylevels[1:5], 10, replace=TRUE))
cbind(test, as.integer(test), as.integer(reverse.levels(test)))
|
Loading required package: ggplot2
Loading required package: xtable
test
[1,] 2 2 3
[2,] 1 1 4
[3,] 4 4 1
[4,] 4 4 1
[5,] 4 4 1
[6,] 2 2 3
[7,] 3 3 2
[8,] 3 3 2
[9,] 4 4 1
[10,] 3 3 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.