| to_sd_categories | R Documentation |
Convert a numeric into a factor divided into three categories according to standard deviation (Below 1 SD, within 1 SD, greater than 1 SD). Useful for plotting interactions with continuous variables.
to_sd_categories(x, na.rm = FALSE)
x |
Vector of numeric values |
na.rm |
If true, remove NAs when calculating mean and SD. If NAs are present and na.rm is false, output will be all NAs |
Vector of 3 level factor by standard deviation.
myVec <- c(1,6,3,6,8,4,19,5,4,1,7,17,20,9,5,5,11,4,3,4,11,4,2,2) myCategoricalVec <- to_sd_categories(myVec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.