Calculate a summary statistic of spectroscopic data in hyperSpec object and return the result as a long-format data frame.

spStat_ldf(sp, by, FUN, ..., var_names = NULL, name_if_by_is_NULL = "All Data")

Arguments

sp

hyperSpec object.

by

(string) name of grouping variable.

FUN

Function of summray statistics.

...

Arguments to be passed to FUN.

var_names

Names of summary statisticsm generated with FUN.

name_if_by_is_NULL

(string) Name of whole dataset in case by is NULL. Default is "All Data"

Value

A long-format data frame.

Examples

spStat_ldf(Spectra2, FUN = mean)
#> Error in getVarValues(by, sp): argument "by" is missing, with no default

spStat_ldf(sp, "gr", FUN = quantile, probs = c(0,1),
           var_names = c("ymin","ymax"))
#> Error in getVarValues(by, sp): object 'sp' not found