shiftSpectra2D: Shift the Spectra in a Spectra2D Object

Description Usage Arguments Value Author(s) Examples

View source: R/shiftSpectra2D.R

Description

Shift the spectra in a Spectra2D object manually. During shifting, some rows or columns are thrown away and new rows or columns are introduced. These new entries may be filled with zeros, or noise from the original spectra.

Usage

1
2
3
4
5
6
7
shiftSpectra2D(
  spectra,
  which = NULL,
  shiftF2 = 0L,
  shiftF1 = 0L,
  fill = "noise"
)

Arguments

spectra

An object of S3 class Spectra2D.

which

An integer specifying which spectra to shift. May be a vector.

shiftF2

Integer. The number of data points to shift along the F2 dimension. See Details.

shiftF1

As per shiftF2, but for the F1 dimension.

fill

Aligning spectra requires that at least some spectra be shifted left/right and up/down. When a spectrum is shifted, spaces are opened that must be filled with something:

  • If fill = "zeros" the spaces are filled with zeros.

  • If fill = "noise" the spaces are filled with an estimate of the noise from the original spectrum.

Value

An object of S3 class Spectra2D.

Author(s)

Bryan A. Hanson, DePauw University.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(MUD2)
# Show the first two spectra, overlaid

mylvls <- seq(5, 35, 5)
plotSpectra2D(MUD2,
  which = 1:2, lvls = LofL(mylvls, 2),
  cols = LofC(c("red", "black"), 2, length(mylvls), 2),
  main = "MUD2 Sample 1 (black) & Sample 2 (red)"
)

# Now shift Sample 2
MUD2s <- shiftSpectra2D(MUD2, which = 2, shiftF1 = -2)
plotSpectra2D(MUD2s,
  which = 1:2, lvls = LofL(mylvls, 2),
  cols = LofC(c("red", "black"), 2, length(mylvls), 2),
  main = "MUD2 Sample 1 (black) & Sample 2 (red)\n(samples now aligned/overlap)"
)

ChemoSpec2D documentation built on March 16, 2021, 9:08 a.m.