dichotomize {crunch} | R Documentation |
Indicate how categories represent a dichotomized value
Description
Multiple Response variables are Categorical Arrays in which one or more categories are set as "selected". These methods allow you to view and set that attribute.
Usage
is.dichotomized(x)
dichotomize(x, i)
undichotomize(x)
is.selected(x)
is.selected(x) <- value
## S4 method for signature 'Categories'
is.dichotomized(x)
## S4 method for signature 'Categories,numeric'
dichotomize(x, i)
## S4 method for signature 'Categories,logical'
dichotomize(x, i)
## S4 method for signature 'Categories,character'
dichotomize(x, i)
## S4 method for signature 'Categories'
undichotomize(x)
## S4 method for signature 'CategoricalVariable,ANY'
dichotomize(x, i)
## S4 method for signature 'CategoricalArrayVariable,ANY'
dichotomize(x, i)
## S4 method for signature 'CategoricalVariable'
undichotomize(x)
## S4 method for signature 'CategoricalArrayVariable'
undichotomize(x)
## S4 method for signature 'Categories'
is.selected(x)
## S4 replacement method for signature 'Categories'
is.selected(x) <- value
## S4 method for signature 'Category'
is.selected(x)
## S4 replacement method for signature 'Category'
is.selected(x) <- value
Arguments
x |
Categories or a Variable subclass that has Categories |
i |
For the |
value |
For |
Details
dichotomize
lets you specify which categories are "selected", while
undichotomize
strips that selection information. Dichotomize converts
a Categorical Array to a Multiple Response, and undichotomize does the reverse.
is.dichotomized
reports whether categories have any selected values.
is.selected
is lower level and maps more directly onto the "selected"
attributes of categories. The best illustration of this difference is that
is.selected(categories(var))
returns a logical vector, a value for each
category, while is.dichotomized(categories(var))
returns a single
TRUE/FALSE
value.
Value
Categories or the Variable, (un)dichotomized accordingly
See Also
Examples
## Not run:
ds <- newExampleDataset()
is.MR(ds$allpets)
is.dichotomized(categories(ds$allpets))
is.selected(categories(ds$allpets))
ds$allpets <- undichotomize(ds$allpets)
is.CA(ds$allpets)
ds$allpets <- dichotomize(ds$allpets, "selected")
is.MR(ds$allpets)
## End(Not run)