| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/is.functions.R |
| 3 |
\name{fac2num} |
| 4 |
\alias{fac2num} |
| 5 |
\title{Turns a factor into a number} |
| 6 |
\usage{ |
| 7 |
fac2num(x, force_integer = FALSE, keep_names = TRUE, ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{x}{an object.} |
| 11 |
|
| 12 |
\item{force_integer}{logical (FALSE). Should the values returned be integers?} |
| 13 |
|
| 14 |
\item{keep_names}{logical (TRUE). Should the values returned keep the \link{names} |
| 15 |
of the original vector?} |
| 16 |
|
| 17 |
\item{...}{ignored.} |
| 18 |
} |
| 19 |
\value{ |
| 20 |
if x is an object - it returns logical - is the object of class dendrogram. |
| 21 |
} |
| 22 |
\description{ |
| 23 |
Turning a factor into a number is not trivial. |
| 24 |
Using \code{as.numeric} would only return to us the indicator numbers |
| 25 |
and NOT the factor levels turned into a number. |
| 26 |
fac2num simply turns a factor into a number, as we often need. |
| 27 |
} |
| 28 |
\examples{ |
| 29 |
|
| 30 |
x <- factor(3:5) |
| 31 |
as.numeric(x) # 1 2 3 |
| 32 |
fac2num(x) # 3 4 5 |
| 33 |
} |