# init SPC
data(sp1)
depths(sp1) <- id ~ top + bottom
# set horizon designation metadata
hzdesgnname(sp1) <- 'name'
# generalize horizon designations from character vector
# result is an ordered factor
sp1$genhz <- generalizeHz(
sp1$name,
new = c('O','A','B','C'),
pat = c('O', '^A','^B','C'),
ordered = TRUE
)
# compute slice-wise GHL probability
# so that it sums to contributing fraction
# from 0-150cm
a <- slab(sp1, fm = ~ genhz, cpm = 1, slab.structure = 0:150)
# note original GHL names are set by slab()
attr(a, 'original.levels')
# generate table of ML horizonation
get.ml.hz(a)
Run the code above in your browser using DataLab