Learn R Programming

hyperSpec (version 0.98-20150304)

mean_sd,numeric-method: Mean and Standard Deviation Calculate mean and standard deviation, and mean, mean $+-$ one standard deviation, respectively.

Description

These functions are provided for convenience.

Usage

"mean_sd"(x, na.rm = TRUE, ...)
"mean_sd"(x, na.rm = TRUE, ...)
"mean_sd"(x, na.rm = TRUE, ...)
"mean_pm_sd"(x, na.rm = TRUE, ...)
"mean_pm_sd"(x, na.rm = TRUE, ...)
"mean_pm_sd"(x, na.rm = TRUE, ...)
"mean"(x, na.rm = TRUE, ...)
"quantile"(x, probs = seq(0, 1, 0.5), na.rm = TRUE, names = "num", ...)

Arguments

x
a numeric vector
na.rm
handed to mean and sd
...
ignored (needed to make function generic)
probs
the quantiles, see quantile
names
"pretty" results in percentages (like quantile's names = TRUE), "num" results in the row names being as.character (probs) (good for ggplot2 getting the order of the quantiles right). Otherwise, no names are assigned.

Value

mean_sd returns a vector with two values (mean and standard deviation) of x.mean_sd (matrix) returns a matrix with the mean spectrum in the first row and the standard deviation in the 2nd.mean_sd returns a hyperSpec object with the mean spectrum in the first row and the standard deviation in the 2nd.mean_pm_sd returns a vector with 3 values: mean - 1 sd, mean, mean + 1 sdmean_pm_sd (matrix) returns a matrix containing mean - sd, mean, and mean + sd rows.For hyperSpec objects, mean_pm_sd returns a hyperSpec object containing mean - sd, mean, and mean + sd spectra.For hyperSpec object, mean returns a hyperSpec object containing the mean spectrum.For hyperSpec object, quantile returns a hyperSpec object containing the respective quantile spectra.

See Also

mean, sd

mean, sd

quantile

Examples

Run this code
mean_sd (flu [,, 405 ~ 410])
mean_sd (flu$spc)
mean_sd (flu)
mean_pm_sd (flu$c)
mean_pm_sd (flu$spc)
mean_pm_sd (flu)
plot (mean (chondro))
plot (quantile (chondro))

Run the code above in your browser using DataLab