average_spc | R Documentation |
Average spectra in list-column of spectra tibble (spc_tbl
) by
groups given in group column.
average_spc(spc_tbl, by = "sample_id", column_in = "spc_rs")
spc_tbl |
Tibble data frame containing at least the grouping column
given in argument |
by |
Character vector of length 1L or name/symbol that specifies the
column by which groups of spectra are averaged. Default is |
column_in |
Character vector of length 1L or or name/symbol that
specifies the list-column that contains the inputs spectra to be averaged.
Default is |
For memory efficiency and subsequent modeling, consider slicing the
extra row copies of spc_mean
resulting from average_spc()
for example by
split(x = spc_tbl, f = spc_tbl$<by>) %>% lapply(., function(x) x x[1, ]) %>% do.call(., rbind)
dplyr::group_by(spc_tbl, <by>) %>% dplyr::slice(1L)
Spectra tibble data frame (class "tbl_df"
, "tbl"
, "data.frame"
)
with a new list-column of column name "spc_mean"
at the last position,
containing mean spectra with identical row replicates within the same
by
-group.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.