Description Usage Arguments Details Value Author(s) See Also Examples
Cut a Numeric Variable into Intervals of about same number of observations.
| 1 2 3 | 
| x | numeric vector to classify into intervals | 
| cuts | cut points | 
| m | desired minimum number of observations in a group | 
| g | number of quantile groups | 
| levels.mean | set to TRUE to make the new categorical vector have levels attribute that is the group means of x instead of interval endpoint labels | 
| digits | number of significant digits to use in constructing levels. Default is 3 (5 if levels.mean=TRUE) | 
| minmax | if cuts is specified but min(x)<min(cuts) or max(x)>max(cuts), augments cuts to include min and max x | 
| oneval | if an interval contains only one unique value, the interval will be labeled with the formatted version of that value instead of the interval endpoints, unless oneval=FALSE | 
| onlycuts | set to TRUE to only return the vector of computed cuts. This consists of the interior values plus outer ranges. | 
| onlymeans | set to TRUE to only return the means of x within each group | 
copied from Hmisc:cutQuantiles to reduce package dependencies.
a factor variable with levels of the form [a,b) or formatted means (character strings) unless onlycuts is TRUE in which case a numeric vector is returned
Thomas Wutzler
seqRange, twMisc
| 1 2 3 4 5 6 7 | set.seed(1)
x <- runif(1000, 0, 100)
z <- cutQuantiles(x, c(10,20,30))
table(z)
table(cutQuantiles(x, g=10))      # quantile groups
cutQuantiles(x, g=10, onlymeans=TRUE)     # get only the means of each group
table(cutQuantiles(x, m=50))      # group x into intevals with at least 50 obs.
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.