Description Usage Arguments Value Examples
Pick a subsample form a spectra collection
1 2 3 4 |
x |
A |
... |
further arguments passed to or from other methods(not currenctly used). |
size |
Size of the sub-sampling |
balance_labels |
A boolean, wether to pick spectra equally between labels. If the subsampling size is below the number of labels, not all labels will be chosen from. |
ids |
A vector of ids to extract, this will override the other parameters. |
a subsample of x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | library(tidySpectR)
library(dplyr)
# Randomly sample
subsample(fa_nmr, size = 3)
# Sample one spectra for each labels
subsample(fa_nmr, size= 2, balance_labels = TRUE)
# Subsample specific IDs
subsample(fa_nmr, ids = c("20199305928", "20199306281", "20199504645"))
# Sample alll spectra of specific labels
organic <- fa_nmr$labels %>%
filter(label == 'organic') %>%
pull(id)
subsample(fa_nmr, ids = organic)
# Chain subsamplings to randomly select a spectra with a specific label
subsample(fa_nmr, ids = organic) %>%
subsample(size=1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.