ids | R Documentation |
Spectra*
object.Either retrieves the wavelengths from a Spectra*
object, or creates a
Spectra*
object from a "data.frame"
object by setting some of
its columns as the wavelengths. The "ids<-"
method for
SpectraDataFrame
objects allows to use a formula interface to use a
column in its data
slot as the object IDs (see the last example provided
in the Examples section).
ids(object, ...)
ids(object) <- value
## S4 replacement method for signature 'Spectra'
ids(object) <- value
## S4 replacement method for signature 'SpectraDataFrame'
ids(object) <- value
object |
an object of class |
... |
|
value |
character vector for new IDs |
The ids
methods return a vector if as.vector
is TRUE,
a data.frame
otherwise. The "ids<-"
method return a
SpectraDataFrame
object (or a Spectra
object if the column in
the data slot that has been used to initiate the IDs was the only
attribute).
ids(object, ..., as.vector = TRUE)
ids(object) <- value
Pierre Roudier pierre.roudier@gmail.com
# Loading example data
data(oz)
spectra(oz) <- sr_no ~ ... ~ 350:2500
# Retrieving ids
ids(oz)
# Setting ids using a vector of values
ids(oz) <- seq_len(nrow(oz))
ids(oz)
# Setting ids using an attribute
oz$new_id <- seq_len(nrow(oz)) + 1000
ids(oz) <- ~ new_id
ids(oz)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.