spStat: [+] Calculate summary statistic of spectroscopic data for all...

View source: R/spStat.R

spStatR Documentation

[+] Calculate summary statistic of spectroscopic data for all spectra and by groups

Description

Calculate summary statistic spectra in hyperSpec object for all spectra and by levels of factor variable by.

Usage

spStat(sp, by, FUN = mean, Name_of.by = as.character(match.call()$by), ...)

Arguments

sp

A hyperSpec object.

by

A grouping variable (either variable name of sp, or vector (factor) of length length(sp)

FUN

A function to apply.

Name_of.by

(Do not change this!) The name of input by.

...further

arguments passed to FUN.

Value

A hyperSpec object that contains summary statistic. Additional column .aggregate is added. In this column levels of grouping variable are indicated.

Note

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).

Author(s)

Vilmantas Gegzna

See Also

aggregate

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()

Examples

spStat(Spectra2, gr)
spStat(Spectra2, by = gr,          FUN = IQR)

## BUG:
# spStat(Spectra2, by = Spectra2$gr, FUN = IQR)


GegznaV/spHelper documentation built on April 16, 2023, 1:42 p.m.