Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/r-utility-factor-numeric.R
This function converts a factor to numeric values in the range from 0 to the number of levels minus one. 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 | as.num0(v)
|
v |
a vector or list of a factor type or another type that can be converted to numeric |
The argument is converted to a numeric representation using
as.numeric
. The resulting values are reduced by 1
if
v
is a factor, to force them into the range between 0
and nlevels(v)-1
.
If v
is a factor then as.numeric(v)-1
, otherwise as.numeric(v)
.
Pawel Cichosz <p.cichosz@elka.pw.edu.pl>
1 2 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.