| percdata | R Documentation |
Computes percentiles (quantiles) for selected numeric columns. By default, six bottom percentiles (0th to 0.5th) and six top percentiles (99.5th to 100th) are calculated. The function supports grouping.
percdata(data, cols = NULL, group = NULL, diff = 0.1,
part = "both", na.rm = TRUE, verbose = FALSE)
data |
A data frame, matrix, or numeric vector. If a vector, a data frame is created internally. |
cols |
Column indices or names of numeric variables. If |
group |
Optional grouping column index or name. If provided, percentiles are computed separately for each group. |
diff |
Common difference between quantile probabilities. Default is 0.1. |
part |
Which parts to return: |
na.rm |
Logical; if |
verbose |
Logical; if |
The function uses stats::quantile() on each selected column. For grouped data, percentiles are computed within each group.
A data frame with rows corresponding to percentiles and columns corresponding to variables (plus a percentile column). If grouped, an additional grouping column is present.
Chun-Sheng Liang <chun-shengliang@qq.com>
1. Example data is from https://smear.avaa.csc.fi/download. It includes particle number concentrations in SMEAR I Varrio forest.
percdata(data, cols = 27:61, group = 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.