| item.reverse | R Documentation |
This function reverse codes inverted items, i.e., items that are negatively worded.
item.reverse(data, ..., min = NULL, max = NULL, keep = NULL, append = TRUE,
name = ".r", as.na = NULL, table = FALSE, check = TRUE)
data |
a numeric vector for reverse coding an item or data frame for reverse coding more than one item. |
... |
an expression indicating the variable names in |
min |
an integer indicating the minimum of the item (i.e., lowest possible scale value). |
max |
an integer indicating the maximum of the item (i.e., highest possible scale value). |
keep |
a numeric vector indicating values not to be reverse coded. |
append |
logical: if |
name |
a character string or character vector indicating the names
of the reverse coded item. By default, variables are named with the ending
|
as.na |
a numeric vector indicating user-defined missing values, i.e. these
values are converted to |
table |
logical: if |
check |
logical: if |
If the arguments min and/or max are not specified, empirical minimum
and/or maximum is computed from the data. Note that reverse coding may fail
if the lowest or highest possible scale value is not represented in the data.
Therefore, it is always preferable to specify the arguments min
and max.
Returns a numeric vector or data frame with the same length or same number of
rows as data containing the reverse coded scale item(s).
Takuya Yanagida takuya.yanagida@univie.ac.at
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. John Wiley & Sons.
item.alpha, item.omega, rec,
item.scores
# Example 1a: Reverse code 'pitem2' and append to 'data.items'
item.reverse(data.items, pitem2, min = 0, max = 3)
# Example 1b: Alternative specification without using the '...' argument
item.reverse(data.items$pitem2, min = 0, max = 3)
# Example 2a: Reverse code 'pitem2' and 'pitem3' and attach to 'data.items'
item.reverse(data.items, pitem2, pitem3, min = 0, max = 3)
# Example 2b: Alternative specification without using the '...' argument
dat <- cbind(data.items,
item.reverse(data.items[, c("pitem2", "pitem3")], min = 0, max = 3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.