Title: Stratigraphic Plug Alignment for Integrating Plug-Based and XRF Data
Version: 0.0.5
Description: Implements the Stratigraphic Plug Alignment (SPA) procedure for integrating sparsely sampled plug-based measurements (e.g., total organic carbon, porosity, mineralogy) with high-resolution X-ray fluorescence (XRF) geochemical data. SPA uses linear interpolation via the base approx() function with constrained extrapolation (rule = 1) to preserve stratigraphic order and avoid estimation beyond observed depths. The method aligns all datasets to a common depth grid, enabling high-resolution multivariate analysis and stratigraphic interpretation of core-based datasets such as those from the Utica and Point Pleasant formations. See R Core Team (2025) https://stat.ethz.ch/R-manual/R-devel/library/stats/html/stats-package.html and Omodolor (2025) http://rave.ohiolink.edu/etdc/view?acc_num=case175262671767524 for methodological background and geological context.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.3
Depends: R (≥ 4.0)
Imports: stats
Suggests: testthat (≥ 3.0.0), knitr, rmarkdown
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2025-12-12 02:40:16 UTC; hxo76
Author: Hope E. Omodolor ORCID iD [aut, cre], Jeffrey M. Yarus [aut]
Maintainer: Hope E. Omodolor <hopeomodolor@gmail.com>
Repository: CRAN
Date/Publication: 2025-12-18 13:40:02 UTC

Stratigraphic Plug Alignment (SPA)

Description

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 to prevent extrapolation beyond the observed depth range, ensuring stratigraphically consistent alignment of all datasets.

Usage

spa_align(ref, ..., depth_col = "Depth_m", rule = 1, add_suffix = TRUE)

Arguments

ref

A data.frame containing the reference depth grid and (optionally) high-resolution variables (e.g., XRF). Must contain the depth column specified in depth_col.

...

One or more named data.frames containing plug-based measurements to be interpolated (e.g., xrd = xrd_df, plugs = plug_df).

depth_col

A character string giving the name of the depth column shared by all input datasets. Defaults to "Depth_m". The depth column may use any unit (e.g., meters, feet, centimeters); "Depth_m" is only a column label and does not require depths to be in meters. However, all input datasets must use the same depth unit for interpolation to be meaningful.

rule

Integer passed to approx() (default 1). rule = 1 prevents extrapolation outside the observed depth range.

add_suffix

Logical; if TRUE, variable names are suffixed with the dataset name (e.g., TOC_plugs, Quartz_xrd).

Details

SPA is intended for vertically ordered core or log data, where measurements are indexed by depth along a stratigraphic profile.

Value

A data.frame containing the reference depth grid and interpolated variables aligned to the same resolution.

Examples

# Synthetic example (for illustration)
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))

aligned <- spa_align(ref, xrd = xrd, plugs = plugs)
head(aligned)