flevels: Get factor levels as a factor

Description Usage Arguments Details Value Author(s) Examples

View source: R/r-utility-flevels.R

Description

This function gets the set of factor levels in the form of a factor rather than a character vector. 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.

Usage

1

Arguments

v

a factor

Details

The set of levels of v is converted to a factor with the very same set of levels.

Value

factor(levels(v), levels = levels(v))

Author(s)

Pawel Cichosz <p.cichosz@elka.pw.edu.pl>

Examples

1
2
3
4
data(weather, package="dmr.data")

flevels(weather$outlook)
flevels(weather$outlook)[as.integer(weather$outlook)]==weather$outlook

42n4/dmr.util documentation built on May 20, 2019, 2:02 p.m.