| spa_align | R Documentation |
Linearly interpolates plug-based measurements (e.g., TOC, porosity, XRD)
onto a high-resolution reference depth grid (e.g., XRF).
The procedure uses base R's approx() with rule = 1 (default)
to prevent extrapolation beyond the observed depth range, ensuring
stratigraphically consistent alignment of all datasets.
spa_align(
ref,
...,
depth_col = "Depth_m",
rule = 1,
add_suffix = TRUE,
trim = FALSE
)
ref |
A data.frame containing the reference depth grid and (optionally)
high-resolution variables (e.g., XRF). Must contain the depth column
specified in |
... |
One or more named data.frames containing plug-based measurements
to be interpolated (e.g., |
depth_col |
A character string giving the name of the depth column
shared by all input datasets. Defaults to |
rule |
Integer passed to |
add_suffix |
Logical; if |
trim |
Logical; if |
SPA is intended for vertically ordered core or log data, where measurements are indexed by depth along a stratigraphic profile.
A data.frame containing the reference depth grid and interpolated variables aligned to the same resolution.
ref <- data.frame(Depth_m = 0:10, Ca = runif(11, 100, 200))
xrd <- data.frame(Depth_m = c(2, 5, 7), Quartz = c(54, 60, 58))
plugs <- data.frame(Depth_m = c(3, 7, 9), TOC = c(3.0, 3.3, 3.5))
# Default: preserves reference depth grid
aligned <- spa_align(ref, xrd = xrd, plugs = plugs)
head(aligned)
# Overlap-only alignment
aligned_overlap <- spa_align(ref, xrd = xrd, plugs = plugs, trim = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.