Learn R Programming

mpspline2

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.

Installation

Install from CRAN with

install.packages('mpspline2')

Install from github with

remotes::install_github("obrl-soil/mpspline2")

Example

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

Asking for help

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 on Bluesky (@obrlsoil) or Mastodon (@obrl_soil) to get my attention.


Copy Link

Version

Install

install.packages('mpspline2')

Monthly Downloads

758

Version

0.1.9

License

GPL

Issues

Pull Requests

Stars

Forks

Maintainer

Lauren O'Brien

Last Published

November 22nd, 2025

Functions in mpspline2 (0.1.9)

mpspline_datchk

pre-spline data checks
mpspline_compact

Spline discrete soils data - multiple sites
mpspline

Spline discrete soils data - multiple sites
mpspline_one

Spline discrete soils data - single site
mpspline_est1

Estimate spline parameters
mpspline_conv

Convert data for splining
mpspline_rmse1

calculate RMSE
mpspline_fit1

Fit spline parameters