# NOT RUN {
# Loading example data
data(australia)
spectra(australia) <- sr_no ~ ... ~ 350:2500
# Simple melt
r <- melt_spectra(australia)
head(r)
# }
# NOT RUN {
# Melt against some factor (or continuous data), and plot
# using ggplot2
# Create some factor
australia$fact <- sample(
LETTERS[1:3],
size = nrow(australia),
replace = TRUE
)
r <- melt_spectra(australia, attr = 'fact')
# Create plot
library(ggplot2)
p <- ggplot(r) +
geom_line(aes(x=wl, y=nir, group=id, colour=fact)) +
theme_bw()
print(p)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab