The function droplevels is used to drop unused levels from a factor or, more commonly, from factors in a data frame.
Usage
# S3 method for factor
droplevels(x, …)
# S3 method for data.frame
droplevels(x, except, …)
Arguments
x
an object from which to drop unused factor levels.
…
further arguments passed to methods
except
indices of columns from which not to drop levels
Value
droplevels returns an object of the same class as x
Details
The method for class "factor" is essentially equivalent to factor(x). The except argument follow the usual indexing rules.
See Also
subset for subsetting data frames.
factor for definition of factors.
drop for dropping array dimensions.
drop1 for dropping terms from a model.
[.factor for subsetting of factors.