droplevels is used to drop unused levels from a
factor or, more commonly, from factors in a data frame.
1 2 3 4
an object from which to drop unused factor levels.
further arguments passed to methods
indices of columns from which not to drop levels
The method for class
"factor" is currently equivalent to
factor(x, exclude=exclude). For the data frame method, you
should rarely specify
exclude “globally” for all factor
columns; rather the default uses the same factor-specific
exclude as the factor method itself.
except argument follow the usual indexing rules.
droplevels returns an object of the same class as
This function was introduced in R 2.12.0. It is primarily
intended for cases where one or more factors in a data frame
contains only elements from a reduced level set after
subsetting. (Notice that subsetting does not in general drop
unused levels). By default, levels are dropped from all factors in a
data frame, but the
except argument allows you to specify
columns for which this is not wanted.
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.
1 2 3 4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.