remap.contig: remap a categorical variable to have contiguous numerical...

Description Usage Arguments Value Examples

Description

Given a factor, this function re-assigns numerical values to each level in such a way that the resulting values are sequential. For example, if the factor has levels "red", "green", and "blue" represented by 1, 10, and 15, this function would return another factor with levels "red", "green", and "blue" with values 1, 2, and 3. This is useful in preparing categorical variables for use with JAGS or Stan.

Usage

1

Arguments

x

the variable to remap, assumed to be a factor

Value

a list whose elements contain

vals

the variable x with the underlying values made contiguous

map

a vector with the mapping from the old to the new levels

len

the number of levels

orig

the original variable that was passed in

Examples

1
2
3
4
## Not run: 
   ## TODO add examples

## End(Not run)

dfeehan/dhstools documentation built on May 15, 2019, 5:12 a.m.