is_NRCS_horizon_organic: Check whether a NRCS soil horizon is organic

View source: R/extract_soils_NRCS_SDA.R

is_NRCS_horizon_organicR Documentation

Check whether a NRCS soil horizon is organic

Description

Based on function CheckTexture(), version 2020-08-31, of the SoilDataDevelopmentToolbox.

Usage

is_NRCS_horizon_organic(x)

Arguments

x

A two-dimensional character object. Required columns are taxorder, taxsubgrp, desgnmaster, texture, and lieutex. Each horizon is represented by exactly one row.

Value

A logical vector representing each horizon. TRUE indicates that a horizon is considered organic; default is FALSE representing mineral soils. NAs in the input propagate.

References

Code based on CheckTexture() version 2020-Aug-31 from https://github.com/ncss-tech/SoilDataDevelopmentToolbox/blob/master/SDA_Valu2Table.py

Examples

x <- data.frame(
  taxorder = c("Histosols", "x", "x", "x", "x", "x", NA),
  taxsubgrp = c("x", "histic", "x", "x", "x", "x", NA),
  desgnmaster = c("L", "L", "O", "x", "x", "x", NA),
  texture = c("x", "x", "x", "CE", "x", "x", NA),
  lieutex = c("x", "x", "x", "x", "Muck", "x", NA)
)

cbind(
  organic = is_NRCS_horizon_organic(x),
  expected_organic = c(FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, NA)
)

## Not run: 
if (curl::has_internet()) {
  x <- fetch_soils_from_NRCS_SDA(bind_params = c(471168, 1606800))
  is_NRCS_horizon_organic(x)
}

## End(Not run)


DrylandEcology/rSW2exter documentation built on May 4, 2024, 10:53 p.m.