eeptools (version 1.2.2)

makenum: a function to convert numeric factors into numeric class objects

Description

This function allows you to convert directly from a numeric factor to the numeric class in R and strip away the underlying level index of a factor. This makes it safer to convert from factors to numeric characters directly without accidentally misassigning numbers.

Usage

makenum(x)

Arguments

x

a factor with numeric levels

Value

A numeric

Details

This function should only be used on factors where all levels are valid numbers that can be coerced into a numeric class.

See Also

character

Examples

Run this code
# NOT RUN {
a <- ordered(c(1, 3, '09', 7, 5))
b <- makenum(a)
class(b)
b
a

# }

Run the code above in your browser using DataLab