R/data.R

#' Example soil water retention dataset
#'
#' A fully synthetic soil characterisation dataset generated to
#' illustrate the functions in **soilFlux**.  Its column layout follows
#' the conventions common to soil characterisation databases (texture
#' fractions, organic carbon, bulk density, standard depth intervals and
#' matric-head points); van Genuchten curves are used to produce
#' internally consistent water-content observations.
#'
#' **No third-party or institutional data are included in or distributed
#' with this package.**  Every value in `swrc_example` is generated by
#' `data-raw/create_example_data.R` from `set.seed(2025)` and is exactly
#' reproducible by re-running that script.
#'
#' @format A data frame with 4 800 rows and 14 columns:
#' \describe{
#'   \item{PEDON_ID}{Character. Unique soil profile identifier
#'     (e.g. `"P0001"`).}
#'   \item{sand_total}{Numeric. Total sand content (%).}
#'   \item{silt}{Numeric. Silt content (%).}
#'   \item{clay}{Numeric. Clay content (%).}
#'   \item{soc}{Numeric. Soil organic carbon (%).}
#'   \item{bd}{Numeric. Bulk density (g/cm3).}
#'   \item{sand_vf}{Numeric. Very fine sand fraction (%).}
#'   \item{sand_f}{Numeric. Fine sand fraction (%).}
#'   \item{sand_m}{Numeric. Medium sand fraction (%).}
#'   \item{sand_c}{Numeric. Coarse sand fraction (%).}
#'   \item{matric_head}{Numeric. Matric head (cm H2O, positive).}
#'   \item{water_content}{Numeric. Volumetric water content (m3/m3).
#'     Approximately 1% of values are `NA` to simulate missing
#'     measurements.}
#'   \item{depth}{Character. Depth interval (e.g. `"0-5"`, `"5-15"`,
#'     etc.).}
#'   \item{Texture}{Character. USDA texture class (one of: Sand,
#'     Loamy Sand, Sandy Loam, Loam, Silt Loam, Clay Loam, Clay).}
#' }
#'
#' @details
#' The dataset contains 120 unique profiles (`PEDON_ID`) across five
#' depth intervals (0–5, 5–15, 15–30, 30–60, 60–100 cm) and eight
#' matric-head points per depth (pF approximately 0, 1, 1.5, 2, 2.5, 3, 4.2, 7).
#' Profiles are evenly distributed across seven USDA texture classes.
#'
#' Water-content observations were generated with the van Genuchten
#' (1980) equation using parameters that vary realistically with texture
#' and depth, then small Gaussian noise was added.
#'
#' @examples
#' data("swrc_example")
#' head(swrc_example)
#' table(swrc_example$Texture[!duplicated(swrc_example$PEDON_ID)])
#'
#' # Prepare for modelling
#' df <- prepare_swrc_data(swrc_example, depth_col = "depth")
#'
#' @source Synthetic dataset generated by
#'   `data-raw/create_example_data.R`.
#'
#' @references
#' van Genuchten, M. T. (1980). A closed-form equation for predicting
#'   the hydraulic conductivity of unsaturated soils. *Soil Science
#'   Society of America Journal*, 44(5), 892–898.
"swrc_example"

Try the soilFlux package in your browser

Any scripts or data that you put into this service are public.

soilFlux documentation built on Dec. 4, 2026, 5:10 p.m.