data("jacobs2000")
# cumulative thickness of horizon designations matching "Bt"
thicknessOf(jacobs2000, "Bt")
# maximum bottom depth minus minimum top depth of horizon designations matching "Bt"
thicknessOf(jacobs2000, "Bt", prefix = "Bt_", method = "minmax")
# cumulative thickness of horizon designations matching "A|B"
thicknessOf(jacobs2000, "A|B", prefix = "AorB_")
# maximum bottom depth minus minimum top depth of horizon designations matching "A|B"
thicknessOf(jacobs2000, "A|B", method = "minmax", prefix = "AorB_")
# note that the latter includes the thickness of E horizons between the A and the B
# when using a custom function (be sure to accept ... and consider the effect of NA values)
# calculate cumulative thickness of horizons containing >18% clay
thicknessOf(jacobs2000, prefix = "claygt18_",
FUN = function(x, ...) !is.na(x[["clay"]]) & x[["clay"]] > 18)
Run the code above in your browser using DataLab