getGroups | R Documentation |
Helps to split the continuous explanatory variable into groups and assigns the group mean. The groups can be split either into groups of equal size (default) or equal number of observations.
getGroups(x, n = NULL, equidistant = FALSE)
x |
The continuous variable to be split |
n |
The number of groups; if NULL then the function determines a number of groups with usually 100 cases or 3 <= n <= 20. |
equidistant |
If set to TRUE, builds equidistant interval, otherwise (default) with equal number of observations |
vector with group means for each observation
x <- rnorm(1000, m = 50, sd = 10)
m <- getGroups(x, n = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.