Learn R Programming

aqp (version 1.25)

munsell2spc,SoilProfileCollection-method: Merge Munsell Hue, Value, Chroma converted to RGB & LAB into a SoilProfileCollection

Description

Convert Munsell hue, value and chroma into [R, G, B] and [L, A, B] color coordinates using munsell2rgb. The converted values are stored in the horizons() slot unless as.spc is FALSE, in which case the results are combined with profile and horizon ID columns and returned as the data.frame subclass used by the SPC.

Usage

# S4 method for SoilProfileCollection
munsell2spc(
  object,
  hue = "hue",
  value = "value",
  chroma = "chroma",
  as.spc = TRUE
)

Arguments

object

A SoilProfileCollection

hue

Column name containing numeric hue values. Default: "hue"

value

Column name containing numeric value values. Default: "value"

chroma

Column name containing numeric chroma values. Default: "chroma"

as.spc

Return a data.frame-like object with ID columns?

Value

A SoilProfileCollection or data.frame-like object

Examples

Run this code
# NOT RUN {
data(sp3)
depths(sp3) <- id ~ top + bottom

# inspect input data
horizons(sp3)[,c("hue","value","chroma")]

# do color conversions to RGB and LAB, join into horizon data
sp3 <- munsell2spc(sp3)

# plot rgb "R" coordinate by horizon
plot(sp3, color = "rgb_R")

# plot lab "A" coordinate by horizon
plot(sp3, color = "lab_A")

# }

Run the code above in your browser using DataLab