categorize: categorize

Description Usage Arguments Value Examples

View source: R/categorize.R

Description

categorize a set of variables automatically into dummy variables. Return data frame with categorized values. The method could only be reference coding or cell means coding.Score coding is not integrated in this function. The main usage for this function is usesd internally in mylm function. But user could also use this to create categorical variables as well.

Usage

1
categorize(data, vars, method = c("reference", "cellmeans"), ref = c())

Arguments

data

input data frame with no NAs, should include all the covariates that will be used later

vars

name vector for the category variables

method

specify the method for categorization

ref

specify the reference level for each categorical variable

Value

data frame with all the category variables transformed to numerous dummy variables.

Examples

1
2
3
data(mydata)
categorize(mydata, c('R_E', 'NIHSS_4Cat'), ref = c(0,1))
categorize(mydata, c('R_E', 'NIHSS_4Cat'), method = 'cellmeans')

cyclopenta/mylinear documentation built on Dec. 19, 2021, 7:07 p.m.