Extract or replace subsets of factors.
# S3 method for factor
[(x, …, drop = FALSE)
# S3 method for factor
[[(x, …)
# S3 method for factor
[(x, …) <- value
# S3 method for factor
[[(x, …) <- value
| Parameter | Description |
|---|---|
x |
a factor |
… |
a specification of indices -- see Extract. |
drop |
logical. If true, unused levels are dropped. |
value |
character: a set of levels. Factor values are coerced to character. |
# NOT RUN {
## following example(factor)
(ff <- factor(substring("statistics", 1:10, 1:10), levels = letters))
ff[, drop = TRUE]
factor(letters[7:10])[2:3, drop = TRUE]
# }