unfactor: Turn a factor back into a vector of integers

View source: R/generate.R

unfactorR Documentation

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

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

pcFactorStan documentation built on Sept. 14, 2023, 1:09 a.m.