spStat.RdCalculate summary statistic spectra in hyperSpec object for all
spectra and by levels of factor variable by.
spStat(sp, by, FUN = mean, Name_of.by = as.character(match.call()$by), ...)A hyperSpec object.
A grouping variable (either variable name of sp,
or vector (factor) of length length(sp)
A function to apply.
(Do not change this!) The name of input by.
arguments passed to FUN.
A hyperSpec object that contains summary statistic. Additional
column .aggregate is added. In this column levels of
grouping variable are indicated.
This function is similar to aggregate,
just calculates additional statistic for all spectra. This
statistic is labeled by adding level .ALL) in variable
.aggregate and variable, that has the same name as by
(if Name_of.by si not modified).
Other spHelper functions for spectroscopy and hyperSpec:
IQR_outliers(),
binning(),
file,
gapDer(),
hy2mat(),
hyAdd_Label_wl(),
hyAdd_Labels_PAP_PD_2014(),
hyAdd_Labels_TD2009(),
hyAdd(),
hyDrop_NA(),
hyGet_palette(),
hyRm_palette(),
mad_outliers(),
mean_Nsd(),
median_Nmad(),
plot_hyPalette(),
prepare_PAP_RK_2014__MATLAB_failui(),
read.OOIBase32(),
read.OceanView.header(),
read.OceanView(),
read.sp.csv2(),
read3csv2hy(),
replace_spc(),
sd_outliers(),
sp_class_perform()
spStat(Spectra2, gr)
#> Error in getVarValues(VAR = by, DATA = sp): object 'gr' not found
spStat(Spectra2, by = gr, FUN = IQR)
#> Error in getVarValues(VAR = by, DATA = sp): object 'gr' not found
## BUG:
# spStat(Spectra2, by = Spectra2$gr, FUN = IQR)