munsell2spc,SoilProfileCollection-method | R Documentation |
Convert Munsell hue, value and chroma into sRGB (rgb_R, rgb_G, rgb_B
) and CIELAB (lab_L, lab_A, lab_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.
## S4 method for signature 'SoilProfileCollection'
munsell2spc(
object,
hue = "hue",
value = "value",
chroma = "chroma",
.data = NULL,
as.spc = TRUE
)
object |
A SoilProfileCollection |
hue |
Column name containing numeric hue values. Default: |
value |
Column name containing numeric value values. Default: |
chroma |
Column name containing numeric chroma values. Default: |
.data |
Optional: a character vector of equal length to number of horizons (containing Munsell notation), or a column name in the horizon data OR a data.frame containing three columns (names specified in |
as.spc |
Return a data.frame-like object with ID columns? |
A SoilProfileCollection or data.frame
-like object
parseMunsell
rgb2munsell
munsell2rgb
data(sp3)
depths(sp3) <- id ~ top + bottom
# inspect input data
horizons(sp3)[,c("hue","value","chroma")]
# do color conversions to sRGB 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")
# note that `lab_A` values do not exactly match the original `A` values
# this is because `lab_A` was computed from the (field determined) Munsell color notation,
# while `A` was directly measured in the lab by colorimeter
plot(sp3$A, sp3$lab_A, xlab = 'Measured', ylab = 'Converted from Field Observed Munsell')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.