classified.default {yamlet} | R Documentation |
Create Classified by Default
Description
Creates a factor of subclass 'classified',
for which there are attribute-preserving methods.
In particular, classified has a codelist attribute
indicating the origin of its levels: it is
constructed from the codelist attribute of x
if available, or from 'levels' and 'labels'
by default. Unlike the case for factor
,
length of labels cannot be one (i.e., different from
length of levels).
Usage
## Default S3 method:
classified(
x = character(),
levels,
labels,
exclude = NA,
ordered = is.ordered(x),
nmax = NA,
token = character(0),
...
)
Arguments
x |
see |
levels |
see |
labels |
see |
exclude |
see |
ordered |
see |
nmax |
see |
token |
informative label for messages |
... |
ignored |
Value
'classified' 'factor'
See Also
Other classified:
[.classified()
,
[<-.classified()
,
[[.classified()
,
[[<-.classified()
,
as.integer.classified()
,
c.classified()
,
classified.classified()
,
classified.data.frame()
,
classified.dvec()
,
classified.factor()
,
classified()
,
desolve.classified()
,
unclassified.classified()
,
unclassified.data.frame()
,
unclassified()
Examples
# classified creates a factor with a corresponding codelist attribute
classified(c('a','b','c'))
# codelist 'remembers' the origins of levels
classified(c('a','b','c'), labels = c('A','B','C'))
# classified is 'reversible'
library(magrittr)
c('a','b','c') %>%
classified(labels = c('A','B','C')) %>%
unclassified