View source: R/gen_coreDataManip.r
do_avg | R Documentation |
Calculate the average spectrum of all the given spectra in a dataset, or define groups to be averaged by providing one or more class-variable.
do_avg(dataset, clv = NULL, inParallel = TRUE)
dataset |
An object of class 'aquap_data" as produced by
|
clv |
Character vector, one or more valid class-variables defining the subsets of the dataset to be averaged. |
inParallel |
Logical, if the averaging of spectra should be done in parallel. Defaults to TRUE. |
The total and group-wise average spectrum is returned each in a
single row with the header-data taken from the first row of the subset of
the original dataset as defined by the grouping. If parameter clv
is
left at the default NULL, all the spectra in the dataset will be averaged
together into a single row.
The transformed dataset.
getcd
Other Data pre-treatment functions:
[,aquap_data-method
,
do_addNoise()
,
do_blowup()
,
do_detrend()
,
do_emsc()
,
do_gapDer()
,
do_msc()
,
do_resampleNIR()
,
do_sgolay()
,
dpt_modules
,
selectWls()
,
ssc()
## Not run:
fd <- gfd() # get the full dataset
fd <- selectWls(fd, 1100, 1800)
fd_avg <- do_avg(fd)
fd_avg2 <- do_avg(ssc(fd, C_water=="MQ")) # assumes the existence of column "C_water"
plot(fd_avg, pg.where="", pg.main="| averaged")
plot(fd - fd_avg, pg.where="", pg.main="| avg subtracted")
#######
fd_avg_group <- do_avg(fd, "C_Group") # averaging within groups
fd_avg_time_group <- do_avg(fd, c("C_Time", "C_Group")) # averaging within a
# subset defined by "C_Time" and "C_Group"
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.