R/mollicEpipedon.R
hasDarkColors.Rd
hasDarkColors
returns a boolean value by horizon representing whether darkness thresholds are met. The code is fully vectorized and deals with missing data and optional thresholds.
Default arguments are set up for "5-3-3 colors" – the basic criteria for Mollic/Umbric epipedon/mineral soil darkness. Any of the thresholds or column names can be altered. Any thresholds that are set equal to NA
will be ignored.
hasDarkColors(
p,
d_hue = NA,
m_hue = NA,
d_value = 5,
d_chroma = NA,
m_value = 3,
m_chroma = 3,
dhuenm = "d_hue",
dvalnm = "d_value",
dchrnm = "d_chroma",
mhuenm = "m_hue",
mvalnm = "m_value",
mchrnm = "m_chroma"
)
A SoilProfileCollection.
Optional: character vector of dry hues to match (default: NA)
Optional: character vector of moist hues to match (default: NA)
Maximum value of dry value (default: 5)
Optional: Maximum value of dry chroma (default: NA)
Maximum value of moist value (default: 3)
Maximum value of moist chroma (default: 3)
Column name containing dry hue.
Column name containing dry value.
Column name containing dry chroma.
Column name containing moist hue.
Column name containing moist value.
Column name containing moist chroma.
Boolean value (for each horizon in p
) reflecting whether "darkness" criteria are met.
# construct a fake profile
spc <- data.frame(id=1, taxsubgrp = "Lithic Haploxeralfs",
hzdesgn = c("A","AB","Bt","BCt","R"),
hzdept = c(0, 20, 32, 42, 49),
hzdepb = c(20, 32, 42, 49, 200),
d_value = c(5, 5, 5, 6, NA),
m_value = c(2.5, 3, 3, 4, NA),
m_chroma = c(2, 3, 4, 4, NA))
# promote to SoilProfileCollection
depths(spc) <- id ~ hzdept + hzdepb
# print results in table
data.frame(id = spc[[idname(spc)]],
hz_desgn = spc$hzdesgn,
has_dark_colors = hasDarkColors(spc))
#> id hz_desgn has_dark_colors
#> 1 1 A TRUE
#> 2 1 AB TRUE
#> 3 1 Bt FALSE
#> 4 1 BCt FALSE
#> 5 1 R NA