View source: R/reverse_score.R
reverse_score | R Documentation |
Calculates the reverse scoring of a standard survey item. You must specify the maximum value of the survey item if the values are all postive (e.g. 7 on a 1 to 7 scale). You may also specify if a scale's range include negative values that straddle zero (e.g. -5 to 5 scales).
reverse_score(x, xmax, negvals = FALSE)
x |
numeric vector |
xmax |
maximum value of scale item |
negvals |
logical indicating if the scale contain negative values |
Robert S. Chavez
x <- sample(1:7, 10, replace = TRUE) reverse_score(x, 7) y <- sample(-5:5, 10, replace = TRUE) reverse_score(y, negvals = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.