Add labels to an existing collection by providing a dat frame or tibble associating sample ids to labels
add_labels(x, ...) # S3 method for collection add_labels(x, labels, ids_from, labels_from, ...)
x | A |
---|---|
... | further arguments passed to or from other methods(not currenctly used). |
labels | A dataframe or tibble associating sample ids to labels |
ids_from | Name of the id column |
labels_from | Name of the label column |
An updated version of collection
.
Pre-existing labels will be overwritten.
library(tidySpectR) library(tibble) newlabs <- tibble(names = pull_ids(fa_nmr), conditions = c("control", "control", "control", "treated", "treated", "treated")) add_labels(fa_nmr, newlabs, ids_from= "names", labels_from= "conditions")#> Spectra collection containing 6 entries. #> Number of bins: 2250 #> Limits: -2.123166e-05 8.999979 #> Labels: control treated #> #> Processing: