unfactor: Convert a factor to a character (or number)

Description Usage Arguments Value Author(s) See Also Examples

Description

Analogous to the function factor, unfactor will convert a factor to a character or integer

Usage

1

Arguments

x

The vector of factors you wish to replace

levels

A numeric vector of the values that will replace the factors

labels

A character vector of the values to be replaced

numeric

Should the labels be returned (i.e., characters)? Or the numbers?

Value

A numeric or character vector

Author(s)

Dustin Fife

See Also

factor

Examples

1
2
3
	#### create sample of male/female participants (at random)
x = as.factor(sample(c("Male", "Female"), 12, replace=TRUE))
unfactor(x, levels=c(0,1), labels=c("Male", "Female"))

vagnerfonseca/fifer documentation built on May 3, 2019, 4:06 p.m.