Learn R Programming

pcFactorStan (version 1.5.4)

unfactor: Turn a factor back into a vector of integers

Description

Factors store values as integers and use a 'levels' attribute to map the integers to labels. This function removes the 'factor' class and levels attribute, leaving the vector of integers.

Usage

unfactor(f)

Arguments

f

a factor

Examples

Run this code
f <- factor(letters[1:3])
print(f)
print(unfactor(f))

Run the code above in your browser using DataLab