colStats | R Documentation |
Calculate some simple statistics like median, min, max or quantiles on columns in a matrix or data.frame object
colStats(x, fun, na.rm = TRUE, q = 0.1, weights = NULL, run.parallel = FALSE)
x |
numerical matrix or data.frame. |
fun |
statistical function that will be calculated. See details. |
na.rm |
logical. Should NA values be removed? |
q |
numerical. Quantile that will be estimated. Used only if fun == quantile. |
weights |
numerical vector. Used if fun == weighted.quantile only. See details. |
run.parallel |
logical. Should the operation be run in parallel? If TRUE, future_apply with the plan "multisession" is used. |
This function uses predefined statistical function that can be used:
min (determine the minimum value)
max (determine the maximum value)
mean (estimate the mean value)
median (estimate the median value)
quantile (estimate a certain quantile value. Note that values between 0 and 1 are accepted)
weighted.quantile (calculation of quantiles using individual weights. Quantile from DescTools
is used.)
numerical vector
Simon Frey
rowStats
colMin
rowMin
rowMax
colMax
# load runoff data
data(runoff)
colStats(runoff, fun = "mean")
colStats(runoff, fun = "max")
colStats(runoff, fun = "quantile", q = 0.33)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.