factor_to_dummy: Creation of dummy variables and reverse

View source: R/factor_to_dummy.R

factor_to_dummyR Documentation

Creation of dummy variables and reverse

Description

Creation of dummy variables and reverse

Usage

factor_to_dummy(x)

dummy_to_factor(x, value = 1L)

Arguments

x

data.frame all 0 / 1

value

integer

Value

data.frame

factor

Examples


 z <- gl(3, 2, 12, labels = c("apple", "salad", "orange"))
table(z)
levels(z) <- list("veg"   = "salad", "fruit" = c("apple", "orange"))
table(z)
z <- factor_to_dummy(z)
table(z)
z <- dummy_to_factor(z)
table(z)

stp4/stp25tools documentation built on Feb. 27, 2025, 11:14 p.m.