dichotomize: dichotomize a numeric vector

Description Usage Arguments Value Author(s) Examples

Description

dichotomize a numeric vector by median or mean split

Usage

1
dichotomize ( numvec , method = c("median","mean") , randomize = TRUE , ... )

Arguments

numvec

numeric vector

method

either median or mean split

randomize

logical, if TRUE elements that equal the split threshold are randomly assigned to one of the two groups if FALSE default behavior of cut is used

...

arguments are passed to set.seed and cut

Value

returns vector with dichotomization indicators

Author(s)

Martin Hecht

Examples

1
2
3
4
5
6
7
8
9
numvec <- c(1,2,3,4,5)
dichotomize ( numvec )

# set seed for random assignment of elements that match split threshold by passing argument 'seed' to function set.seed
# ( '3' in numvec is on threshold if median is used )
dichotomize ( numvec , seed = 12345 )

# set level names by passing argument 'labels' to cut function
dichotomize ( numvec , labels = c ( "low" , "high") )

eatRest documentation built on May 2, 2019, 6:25 p.m.

Related to dichotomize in eatRest...