
soil.slot.multiple(data, g, vars, seg_size=NA, strict=FALSE, user.fun=NULL)
soil.slot
, but with depth-slice information repeated for each requested input variable.soil.slot
, that makes it simpler to "slice" several soil properties at once. The results are in long format; see examples for further processing steps that may be required.soil.slot
, unroll
data(sp3)
# add new grouping factor
sp3$group <- 1
sp3$group[as.numeric(sp3$id) > 5] <- 2
sp3$group <- factor(sp3$group)
# slot several variables at once
# within each level of 'group'
# according to 5 cm vertcal increments
a <- soil.slot.multiple(sp3, g='group', vars=c('L','A', 'B'), seg_size=5)
# pre-compute intervals
a$upper <- with(a, p.mean + p.sd)
a$lower <- with(a, p.mean - p.sd)
# check the results
xyplot(
top ~ p.mean | variable, data=a, groups=groups, subscripts=TRUE,
lower=a$lower, upper=a$upper, ylim=c(125,-5), alpha=0.5,
layout=c(3,1), scales=list(x=list(relation='free')),
panel=panel.depth_function,
prepanel=prepanel.depth_function
)
# convert mean value for each variable into long format
a.wide <- cast(a, groups + top + bottom ~ variable, value=c('p.mean'))
Run the code above in your browser using DataLab