This package is a standalone re-implementation of
GSIF::mpspline()
,
which applies a mass-preserving spline to soil attributes. Splining soil
data is a safe way to make continuous down-profile estimates of
attributes measured over discrete, often discontinuous depth intervals.
Install from CRAN with
install.packages('mpspline2')
Install from github with
devtools::install_github("obrl-soil/mpspline2")
library(mpspline2)
dat <- data.frame("SID" = c( 1, 1, 1, 1),
"UD" = c( 0, 20, 40, 60),
"LD" = c(10, 30, 50, 70),
"VAL" = c( 6, 4, 3, 10),
stringsAsFactors = FALSE)
dat
#> SID UD LD VAL
#> 1 1 0 10 6
#> 2 1 20 30 4
#> 3 1 40 50 3
#> 4 1 60 70 10
spl_dat <- mpspline_tidy(obj = dat, var_name = 'VAL')
spl_dat$est_dcm
#> SID UD LD SPLINED_VALUE
#> 1.1 1 0 5 6.105160
#> 1.2 1 5 15 5.618341
#> 1.3 1 15 30 4.316876
#> 1.4 1 30 60 4.192058
#> 1.5 1 60 100 9.732400
If you get stuck using this package, please post a question on Stack Overflow. This means that others can benefit from the discussion, and more people are available to help you. You’re welcome to ping me in a comment or on twitter (@obrl_soil) to get my attention.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.