Description Usage Arguments Note Examples
Reduce the resolution of Spectra
1 2 3 4 | reduce_resolution(x, ...)
## S3 method for class 'collection'
reduce_resolution(x, k, ...)
|
x |
A |
... |
further arguments passed to or from other methods(not currently used). |
k |
an integer expressing the reduction in resolution.
For example |
Reducing resolution of the spectra before computation intensive steps like AI binning can significantly improve their speed, while minimally affecting the output.
You should however be careful with the choice of k and in the caase of subsequent binning make sure to remove the outter limits of the returned results as these will not match the outter limits of the full resolution spectra.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | library(tidySpectR)
# Speeding up AI binning
reduced <- reduce_resolution(fa_nmr, k=2)
binned <- bucket_aibin(extract(reduced,0.5, 7.2),
0.5,
mask(reduced, -Inf, 8))
breaks <- pull_breaks(binned)
# last break does not match spectra limit, leaving it so would create
# a bin at the ends of the spectra
breaks[1]
breaks[length(breaks)]
pull_limits(extract(fa_nmr, 0.5, 7.2))
breaks <- breaks[-1] # remove first break
breaks <- breaks[-length(breaks)] # remove last break
processed <- bucket_from_breaks(extract(fa_nmr, 0.5, 7.2), breaks)
# Full resolution bucketted spectra
processed
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.