updateGroups {ChemoSpecUtils} | R Documentation |
Update Group Names in a Spectra or Spectra2D Object
Description
A convenience function that can be used to update (change)
group names. The default group names come from the gr.crit
argument in the import functions files2SpectraObject
,
matrix2SpectraObject
or
files2Spectra2DObject
. In some cases gr.crit
may have complex regex patterns, and this function makes updating them to more
appropriate/more readible strings easier.
Usage
updateGroups(spectra, new.grps = NULL, silent = FALSE)
Arguments
spectra |
An object of S3 class |
new.grps |
A vector of character values giving the new group names.
The new values must correspond to the order of the old values. This vector should
give the unique values only (so, it should have |
silent |
Logical. If |
Value
spectra 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(metMUD1)
metMUD1a <- updateGroups(metMUD1) # reports old groups
metMUD1a <- updateGroups(metMUD1, new.grps = c("C", "T"))
}
if (checkForPackageWithVersion("ChemoSpec2D", 0.5)) {
library("ChemoSpec2D")
data(MUD1)
MUD1a <- updateGroups(MUD1, new.grps = c("control", "treatment"))
}