Description Value Methods Author(s) See Also Examples
Either retrieves the attributes values from the data slot of a SpectraDataFrame object, or upgrades a Spectra object to a SpectraDataFrame object by initialising its data slot by a suitable "data.frame"
object.
The features
methods return a data.frame
object, while the "features<-"
methods return a SpectraDataFrame
object.
x=Spectra
features(obj, safe=TRUE, key=NULL, exclude_id=TRUE) <- value
obj | A Spectra object |
|
safe | Logical. If TRUE, data is being added to the object using a SQL join (using a key field given by the key option), otherwise it is assumed the order of the rows is consitent with the order of the rows in obj |
|
key | Character, name of the column of the data.frame storing the ids for the SQL join. Ignored if safe is FALSE . |
|
exclude_id | Logical, if TRUE , ids used for the SQL join are removed from the data slot after the join. |
|
x=SpectraDataFrame
features(obj, exclude_id=TRUE)
features(obj, safe=TRUE, key=NULL, exclude_id=TRUE, append=TRUE) <- value
obj | A SpectraDataFrame object |
|
safe | Logical. If TRUE, data is being added to the object using a SQL join (using a key field given by the key option), otherwise it is assumed the order of the rows is consitent with the order of the rows in obj |
|
key | Character, name of the column of the data.frame storing the ids for the SQL join. Ignored if safe is FALSE . |
|
exclude_id | Logical. For the features method, if TRUE , the spectra ids are added to the data.frame that is returned. For the "features<-" method, If TRUE , ids used for the SQL join are removed from the data slot after the join. |
|
append | Logical, if TRUE , the data is appended to any existing data. if FALSE, the data provided is erasing any existing data. |
|
Pierre Roudier pierre.roudier@gmail.com
spectra
, wl
, SpectraDataFrame-class
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Loading example data
data(australia)
spectra(australia) <- sr_no ~ ... ~ 350:2500
# Printing available data
features(australia)
# Promoting a Spectra to a SpectraDataFrame object
s <- as(australia, "Spectra")
# Generating dummy data
d <- data.frame(id = ids(australia), foo = runif(nrow(australia)), bar = sample(LETTERS[1:5], size = nrow(australia), replace = TRUE))
head(d)
# Affecting data to Spectra object
features(s, key = 'id') <- d
summary(s)
# Adding data to an existing SpectraDataFrame object
features(australia, key = 'id') <- d
features(australia)
# Replacing data of an existing SpectraDataFrame object
features(australia, key = 'id', append = FALSE) <- d
features(australia)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.