reversed | R Documentation |
The function reversed()
returns a copy of its argument with codes
or levels in reverse order.
reversed(x)
## S4 method for signature 'item.vector'
reversed(x)
## S4 method for signature 'factor'
reversed(x)
x |
An object – an "item" object or a "data.set" object |
If the argument of the function reversed()
than either the
unique valid values or the labelled valid values recoded into the
reverse order.
If th argument is a factor than the function returns the factor with levels in reverse order.
ds <- data.set(
x = as.item(sample(c(1:3,9),100,replace=TRUE),
labels=c("One"=1,
"Two"=2,
"Three"=3,
"Missing"=9)))
df <- as.data.frame(ds)
ds <- within(ds,{
xr <- reversed(x)
})
codebook(ds)
df <- within(df,{
xr <- reversed(x)
})
codebook(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.