| hyRm_palette | R Documentation | 
hyperSpec objectAdd (or overwrite, if already exists) a column .color with color
names that correspond to levels of factor variable by.
Function hyRm_palette removes this palette.
hyRm_palette(sp = NULL)
hyAdd_palette(
  sp = NULL,
  by,
  palette = c(RColorBrewer::brewer.pal(9, "Set1")),
  label = NULL,
  ...
)
hyAdd_color(
  sp = NULL,
  by,
  palette = c(RColorBrewer::brewer.pal(9, "Set1")),
  label = NULL,
  ...
)
sp | 
 
  | 
by | 
 A factor variale which levels will correspond to colors in
  | 
palette | 
 A color palette (vector with colors for each level in
  | 
label | 
 Label for column   | 
HyperSpec object with added/replaced column .color.
Lables of variable .color indicate unique colors used
(illustration in section "Examples").
Vilmantas Gegzna
Other spHelper functions for spectroscopy and hyperSpec: 
IQR_outliers(),
binning(),
file,
gapDer(),
hy2mat(),
hyAdd_Label_wl(),
hyAdd_Labels_PAP_PD_2014(),
hyAdd_Labels_TD2009(),
hyAdd(),
hyDrop_NA(),
hyGet_palette(),
mad_outliers(),
mean_Nsd(),
median_Nmad(),
plot_hyPalette(),
prepare_PAP_RK_2014__MATLAB_failui(),
read.OOIBase32(),
read.OceanView.header(),
read.OceanView(),
read.sp.csv2(),
read3csv2hy(),
replace_spc(),
sd_outliers(),
spStat(),
sp_class_perform()
data(Spectra2)
Spectra1 <- hyAdd_color(Spectra2, "class")
colnames(Spectra2)
   #> [1] "gr"    "class" "spc"
colnames(Spectra1)
   #> [1] "gr"     "class"  "spc"    ".color"
# Default labels
labels(Spectra1,".color")
   #>  [1] "Colors for \"class\""
hyGet_palette(Spectra1)
   #>  "#377EB8" "#4DAF4A" "#984EA3" "#FF7F00"
# ATTENTION -------------------------------------------------
# Preserve labels:
Spectra1[1,".color"] <- "red"
hyGet_palette(Spectra1)
labels(Spectra1,".color")
# Overwrites labels:
Spectra1$.color[1] <- "red"
hyGet_palette(Spectra1)
labels(Spectra1,".color")
    #>  ".color"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.