facttonum: facttonum converts a vector of numeric factors into numbers

View source: R/rutils.R

facttonumR Documentation

facttonum converts a vector of numeric factors into numbers

Description

facttonum converts a vector of numeric factors into numbers. If the factors are not numeric then the outcome will be a series of NA. It is up to you to apply this function only to numeric factors. A warning will be thrown if the resulting output vector contains NAs

Usage

facttonum(invect)

Arguments

invect

vector of numeric factors to be converted back to numbers

Value

an output vector of numbers instead of the input factors

Examples

## Not run: 
 DepCat <- as.factor(rep(seq(100,600,100),2)); DepCat
 5 * DepCat[3]
 as.numeric(levels(DepCat))  # #only converts levels not the replicates
 DepCat <- facttonum(DepCat)
 5 * DepCat[3]
 x <- factor(letters)
 facttonum(x)

## End(Not run)

haddonm/codeutils documentation built on April 15, 2024, 1:02 p.m.