Extract.factor: Extract or Replace Parts of a Factor
Description
Extract or replace subsets of factors.
Usage
# S3 method for factor
[(x, …, drop = FALSE)
# S3 method for factor
[[(x, …)
# S3 method for factor
[(x, …) <- value
# S3 method for factor
[[(x, …) <- value
character: a set of levels. Factor values are coerced to
character.
Value
A factor with the same set of levels as x unless drop = TRUE.
Details
When unused levels are dropped the ordering of the remaining levels is
preserved. If value is not in levels(x), a missing value is
assigned with a warning. Any contrasts assigned to the factor are preserved
unless drop = TRUE. The [[ method supports argument exact.