removeGroup: Remove a Group from a Spectra or Spectra2D Object

View source: R/removeGroup.R

removeGroupR Documentation

Remove a Group from a Spectra or Spectra2D Object

Description

Removes specified groups from a Spectra or Spectra2D object.

Usage

removeGroup(spectra, rem.group)

Arguments

spectra

An object of S3 class ChemoSpec::Spectra() or ChemoSpec2D::Spectra2D().

rem.group

A character vector (handled as a regex) giving the groups to be removed.

Details

This function will report if extra data elements are found. These will probably need to be edited manually. The indices reported to the console can be helpful in this regard.

If rem.group is a character vector, the sample names are grepped for the corresponding values. Remember that the grepping process is greedy, i.e. grepping for "XY" find not only "XY" but also "XYZ".

Unused levels in $groups are dropped.

Value

An object of S3 class ChemoSpec::Spectra() or ChemoSpec2D::Spectra2D().

Author(s)

Bryan A. Hanson (DePauw University).

Examples

if (checkForPackageWithVersion("ChemoSpec", 6.0)) {
  library("ChemoSpec")
  data(SrE.IR)

  sumGroups(SrE.IR)
  SrE.IRa <- removeGroup(SrE.IR, rem.group = "pSrE")
  sumGroups(SrE.IRa)
}

if (checkForPackageWithVersion("ChemoSpec2D", 0.5)) {
  library("ChemoSpec2D")
  data(MUD1)

  sumGroups(MUD1)
  MUD1a <- removeGroup(MUD1, rem.group = "Ether")
  sumGroups(MUD1a)
}

ChemoSpecUtils documentation built on May 31, 2023, 5:56 p.m.