knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.align = 'center', fig.height = 5, fig.width = 5 )
library(spectacles)
SpectraDataFramedata("australia") class(australia) big.head(australia)
spectra(australia) <- sr_no ~ ... ~ 350:2500 summary(australia)
SpectraDataFrame objectSpectraDataFramenrow returns the number of samples in the object:
nrow(australia)
ncol returns the number of attributes in the data slot of the object, and returns NULL if the object does not have associated data:
ncol(australia)
length returns the number of wavelengths in the object:
length(australia)
dim returns a numeric vector of these three dimensions:
dim(australia)
sub <- australia[1:5,] summary(sub)
Specific functions are available to access the various properties of Spectra objects:
ids is returning a vector containing the IDs of the object. It has a as.vector option. When turned to FALSE, the function returns a data.frame instead of a vector. This is particularly useful to retrieve the original column name of the IDs:
# Just printing the first 5 ids(australia)[1:5]
wl is returning the wavelengths of the object in a numeric vector:
# Just printing the first 10 wl(australia)[1:10]
spectra is returning the spectra matrix:
s <- spectra(australia) class(s) dim(s) big.head(s)
wl_units is returning the wavelength units:
wl_units(australia)
features is returning associated data into a data.frame:
df <- features(australia) class(df) head(df)
plot(australia)
plot(australia, col = "royalblue")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.