unmap_categories: Map categorical data to values

Description Usage Arguments Value

View source: R/unmap_categories.R

Description

Map categorical data to specified values of new (or same) type.

Usage

1
unmap_categories(X, to_categories)

Arguments

X

named list or data.frame; list or data.frame of factor data

to_categories

named list; each named item is of the value-type to map the item or column with the same name X to, with the names of each value being the label of the (corresponding) factor to map from, e.g. to map the factor levels 'A' and 'B' to integers 1 and 2 respectively for a column called dummy, then to_categories=list(dummy=c(A=1L,B=2L))

Value

list or data.frame; list or data.frame of the same shape as X with factors mapped to the values specified in to_categories.


stephematician/miForang documentation built on July 23, 2019, 5:11 p.m.