File: fac2num.Rd

package info (click to toggle)
r-cran-dendextend 1.14.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,888 kB
  • sloc: sh: 13; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 877 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/is.functions.R
\name{fac2num}
\alias{fac2num}
\title{Turns a factor into a number}
\usage{
fac2num(x, force_integer = FALSE, keep_names = TRUE, ...)
}
\arguments{
\item{x}{an object.}

\item{force_integer}{logical (FALSE). Should the values returned be integers?}

\item{keep_names}{logical (TRUE). Should the values returned keep the \link{names}
of the original vector?}

\item{...}{ignored.}
}
\value{
if x is an object - it returns logical - is the object of class dendrogram.
}
\description{
Turning a factor into a number is not trivial.
Using \code{as.numeric} would only return to us the indicator numbers
and NOT the factor levels turned into a number.
fac2num simply turns a factor into a number, as we often need.
}
\examples{

x <- factor(3:5)
as.numeric(x) # 1 2 3
fac2num(x) # 3 4 5
}