Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

spc2mpspline-SoilProfileCollection-method

Missing-data-safe, SPC-wide wrapper around mpspline2::mpspline "continuous" 1cm output


Description

Facilitate safe use of just about any numeric SPC horizon attribute, from any SPC, with mpspline2::mpspline. Currently only works with a single attribute.This function will automatically filter profiles with NA in attribute of interest which may be more conservative filtering than you expect. The intention here is that a SPC of related profile instances could be splined, and then the spline results aggregated over the full interval where data was available.

Data completeness is assessed and the input SPC is filtered and truncated to create a container for the 1cm results from mpspline2::mpspline.

Usage

## S4 method for signature 'SoilProfileCollection'
spc2mpspline(
  object,
  var_name = NULL,
  pattern = "R|Cr|Cd|qm",
  hzdesgn = guessHzDesgnName(object),
  ...
)

Arguments

object

A SoilProfileCollection

var_name

Column name in @horizons slot of object containing numeric values to spline

pattern

Regex pattern to match for bottom of profile (passed to estimateSoilDepth) default: "R|Cr|Cd|qm"

hzdesgn

Column name in @horizons slot of object containing horizon designations default: aqp::guessHzDesgnName(object)

...

Additional arguments to mpspline2::mpspline

Value

A SoilProfileCollection with 1cm slices. Spline variables are in columns prefixed with "spline_" and RMSE/RMSE_IQR are in colums prefixed with "rmse_". If any profiles were removed from the collection, their profile IDs are stored in attr(result, 'removed').

Author(s)

Andrew G. Brown

Examples

data(sp1)
depths(sp1) <- id ~ top + bottom

res <- spc2mpspline(sp1, "prop")

plotSPC(res[1:5,], color = "prop_spline", divide.hz = FALSE)

aqp

Algorithms for Quantitative Pedology

v1.29
GPL (>= 3)
Authors
Dylan Beaudette [aut, cre], Pierre Roudier [aut, ctb], Andrew Brown [aut, ctb]
Initial release
2021-04-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.