Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/r-utility-label.R
This function converts a numeric vector to a factor with specified sets of levels and labels, possibly including levels not occurring in the input vector (which also have the corresponding labels assigned). It is used in examples presented in the book Cichosz, P. (2015): Data Mining Algorithms: Explained Using R. See Appendix B or http://www.wiley.com/go/data_mining_algorithms for more details.
1 |
v |
an input vector |
levels |
a vector specifying the set factor levels |
labels |
a vector specifying the set of factor labels |
The input vector v
is converted to a factor with the set
of levels specified by the levels
argument and the set of
corresponding labels specified by the labels
argument. All levels
are assigned the corresponding labels, including those not occurring in v
.
Values from v
which do not appear in levels
are replaced by
NA
.
If levels!=NULL
then factor(v, levels=levels, labels=labels)
and as.factor(v)
otherwise.
Pawel Cichosz <p.cichosz@elka.pw.edu.pl>
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.