Description Usage Arguments Value Modifying Spectra2D Objects Author(s) See Also Examples

This function removes specified frequencies from a `Spectra`

or `Spectra2D`

object.
For instance, one might want to remove regions lacking any useful
information (to reduce the data size), remove regions with large
interfering peaks (e.g. the water peak in 1H NMR) or simply focus
on a region of interest.

1 | ```
removeFreq(spectra, rem.freq = NULL, remF2 = NULL, remF1 = NULL)
``` |

`spectra` |
An object of S3 class |

`rem.freq` |
For a |

`remF2` |
Applies to |

`remF1` |
As for |

An object of S3 class `Spectra`

or
`Spectra2D`

.

Regarding `Spectra2D`

objects, one cannot remove frequencies from the interior of
a 2D NMR data set and expect
to get a meaningful contour plot, because doing so puts unrelated peaks adjacent
in the data set. This would lead to contours being drawn that don't exist in the
original data set. However, one can remove data from the interior and run a PARAFAC
analysis on the result, using the spectrum as an abstract object (that is, the
spectrum may not plottable, but the resulting scores are still meaningful).

Bryan A. Hanson, DePauw University.

`removePeaks2D`

for another way to remove data.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | ```
if (checkForPackageWithVersion("ChemoSpec", "5.1")) {
library("ChemoSpec")
data(SrE.IR)
sumSpectra(SrE.IR)
# Examples where rem.freq is a logical vector
# Remove frequencies from one end:
newIR <- removeFreq(SrE.IR, rem.freq = SrE.IR$freq > 3500)
# Remove frequencies from both ends at once:
newIR <- removeFreq(SrE.IR, rem.freq = SrE.IR$freq > 3500
| SrE.IR$freq < 800)
# Remove frequencies from the middle:
newIR <- removeFreq(SrE.IR, rem.freq = SrE.IR$freq > 800
& SrE.IR$freq < 1000)
# The logic of this last one is as follows. Any values
# that are TRUE will be removed.
values <- 1:7
values > 2
values < 6
values > 2 & values < 6
# Examples where rem.freq is a formula
# Remove frequencies from one end:
newIR <- removeFreq(SrE.IR, rem.freq = 3500 ~ high)
# Remove frequencies from both ends is a two step process with formulas:
newIR <- removeFreq(SrE.IR, rem.freq = 3500 ~ high)
newIR <- removeFreq(newIR, rem.freq = low ~ 800)
# Remove frequencies from the middle:
newIR <- removeFreq(SrE.IR, rem.freq = 800 ~ 1000)
# After any of these, inspect the results:
sumSpectra(newIR)
}
if (checkForPackageWithVersion("ChemoSpec2D", "0.3")) {
library("ChemoSpec2D")
data(MUD1)
plotSpectra2D(MUD1,
which = 7, lvls = seq(-1, 1, by = 0.2),
main = "MUD1 Sample 7: Complete Data Set"
)
MUD1a <- removeFreq(MUD1, remF2 = 2 ~ 4)
sumSpectra(MUD1a) # cannot plot, results would be misleading
MUD1b <- removeFreq(MUD1, remF1 = low ~ 20)
sumSpectra(MUD1b)
plotSpectra2D(MUD1b,
which = 7, lvls = seq(-1, 1, by = 0.2),
main = "MUD1 Sample 7\nRemoved Frequencies: F1 low ~ 20"
)
MUD1c <- removeFreq(MUD1, remF2 = low ~ 2)
sumSpectra(MUD1c)
plotSpectra2D(MUD1c, ,
which = 7, lvls = seq(-1, 1, by = 0.2),
main = "MUD1 Sample 7\nRemoved Frequencies: F2 low ~ 2"
)
MUD1d <- removeFreq(MUD1, remF2 = 3 ~ high, remF1 = 45 ~ 55)
sumSpectra(MUD1d) # not plotted, results would be misleading
}
``` |

```
Serenoa repens IR quality study
There are 16 spectra in this set.
The y-axis unit is absorbance.
The frequency scale runs from
399.2123 to 3999.837 wavenumber
There are 1868 frequency values.
The frequency resolution is
1.9286 wavenumber/point.
The spectra are divided into 4 groups:
group no. color symbol alt.sym
1 adSrE 10 #984EA3 15 d
2 EPO 1 #377EB8 2 b
3 OO 1 #4DAF4A 3 c
4 pSrE 4 #E41A1C 1 a
*** Note: this is an S3 object
of class 'Spectra'
Serenoa repens IR quality study
There are 16 spectra in this set.
The y-axis unit is absorbance.
The frequency scale runs from
399.2123 to 3999.837 wavenumber
There are 1764 frequency values.
The frequency resolution is
1.9286 wavenumber/point.
This data set is not continuous
along the frequency axis.
Here are the data chunks:
beg.freq end.freq size beg.indx end.indx
1 399.2123 798.4247 399.2124 1 208
2 1000.9240 3999.8370 2998.9130 209 1764
The spectra are divided into 4 groups:
group no. color symbol alt.sym
1 adSrE 10 #984EA3 15 d
2 EPO 1 #377EB8 2 b
3 OO 1 #4DAF4A 3 c
4 pSrE 4 #E41A1C 1 a
*** Note: this is an S3 object
of class 'Spectra'
MUD1: HSQC-like data for testing. See ?MUD1
There are 10 spectra in this set.
The F2 dimension runs from 0 to 5 ""^1 * H ~ ppm
and there are 60 data points.
The F2 dimension has gaps. Here are the data chunks:
beg.freq end.freq size beg.indx end.indx
1 0.000000 1.969697 1.969697 1 40
2 4.040404 5.000000 0.959596 41 60
The F1 dimension runs from 10 to 80 ""^13 * C ~ ppm
and there are 50 slices.
The spectra are divided into 2 groups:
group no. color
1 Alcohol 5 black
2 Ether 5 red
*** Note: this is an S3 object
of class 'Spectra2D'
MUD1: HSQC-like data for testing. See ?MUD1
There are 10 spectra in this set.
The F2 dimension runs from 0 to 5 ""^1 * H ~ ppm
and there are 100 data points.
The F1 dimension runs from 21.42857 to 80 ""^13 * C ~ ppm
and there are 42 slices.
The spectra are divided into 2 groups:
group no. color
1 Alcohol 5 black
2 Ether 5 red
*** Note: this is an S3 object
of class 'Spectra2D'
MUD1: HSQC-like data for testing. See ?MUD1
There are 10 spectra in this set.
The F2 dimension runs from 2.020202 to 5 ""^1 * H ~ ppm
and there are 60 data points.
The F1 dimension runs from 10 to 80 ""^13 * C ~ ppm
and there are 50 slices.
The spectra are divided into 2 groups:
group no. color
1 Alcohol 5 black
2 Ether 5 red
*** Note: this is an S3 object
of class 'Spectra2D'
MUD1: HSQC-like data for testing. See ?MUD1
There are 10 spectra in this set.
The F2 dimension runs from 0 to 2.979798 ""^1 * H ~ ppm
and there are 60 data points.
The F1 dimension runs from 10 to 80 ""^13 * C ~ ppm
and there are 43 slices.
The F1 dimension has gaps. Here are the data chunks:
beg.freq end.freq size beg.indx end.indx
1 10.00000 44.28571 34.28571 1 25
2 55.71429 80.00000 24.28571 26 43
The spectra are divided into 2 groups:
group no. color
1 Alcohol 5 black
2 Ether 5 red
*** Note: this is an S3 object
of class 'Spectra2D'
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.