checkHzDepthLogic: Check a SoilProfileCollection object for errors in horizon...

Description Usage Arguments Value Author(s) Examples

View source: R/checkHzDepthLogic.R

Description

This function inspects a SoilProfileCollection object, looking for four common errors in horizon depths:

  1. bottom depth shallower than top depth

  2. equal top and bottom depth

  3. missing top or bottom depth (e.g. NA)

  4. gap or overlap between adjacent horizons

Usage

1
2
3
4
5
6
7
checkHzDepthLogic(
  x,
  hzdepths = NULL,
  idname = NULL,
  fast = FALSE,
  byhz = FALSE
)

Arguments

x

SoilProfileCollection or data.frame object to check

hzdepths

SoilProfileCollection uses horizonDepths(x) Default: NULL; if x is a data.frame, character vector of column names of top and bottom depths

idname

SoilProfileCollection uses idname(x) Default: NULL; if x is a data.frame, character vector with column name of unique profile ID;

fast

If details about specific test results are not needed, the operation can allocate less memory and run approximately 5x faster. Default: FALSE

byhz

Apply logic tests to profiles or individual horizons?

Value

A data.frame containing profile IDs, validity boolean (valid) and test results if fast = FALSE.

The data.frame will have as many rows as profiles in x (length(x)).

Author(s)

D.E. Beaudette, A.G. Brown, S.M. Roecker

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## sample data

data(sp3)
depths(sp3) <- id ~ top + bottom

# these data should be clean
res <- checkHzDepthLogic(sp3)

head(res)

# less memory if only concerned about net validity
res <- checkHzDepthLogic(sp3, fast = TRUE)

head(res)

aqp documentation built on Sept. 29, 2021, 9:09 a.m.