fact2num: Converts "numeric" factor levels to numeric values.

Description Usage Arguments Value Author(s) Examples

View source: R/FSAUtils.R

Description

Converts “numeric” factor levels to numeric values.

Usage

1
fact2num(object)

Arguments

object

A vector with “numeric” factor levels to be converted to numeric values.

Value

A numeric vector.

Author(s)

Derek H. Ogle, derek@derekogle.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
junk <- factor(c(1,7,2,4,3,10))
str(junk)
junk2 <- fact2num(junk)
str(junk2)

## ONLY RUN IN INTERACTIVE MODE
if (interactive()) {

bad <- factor(c("A","B","C"))
# This will result in an error -- levels are not 'numeric'
bad2 <- fact2num(bad)

}  ## END IF INTERACTIVE MODE


FSA documentation built on May 19, 2017, 1:13 p.m.
Search within the FSA package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.