Description Usage Arguments Value Author(s) Examples
dichotomize a numeric vector by median or mean split
1 |
numvec |
numeric vector |
method |
either median or mean split |
randomize |
logical, if |
... |
arguments are passed to set.seed and cut |
returns vector with dichotomization indicators
Martin Hecht
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") )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.