texture.class: Sanitize texture class descriptions

Description Usage Arguments Value Examples

Description

This collection of functions transforms input to a vector of USDA soil classes that can be used as input to other functions in this package. If x is a character or factor, it is transformed by assuming "sand" is represented by "Sa", "S", or "Sand"; "silt" is represented by "Si" or "Silt"; "clay" is represented by "Cl", "C", or "Clay"; and "loam" is represented by "Lo", "L", or "Loam". The components must be separated by a space. If input is numeric, the input order is sand, then clay, then silt. If silt is provided, input checked to make sure sand + clay + silt == 1 or sand + clay + silt == 100. If all values are less than or equal to 1, a total sum of 1 is assumed; if not, a total sum of 100 is assumed. x is a data.frame, columns for sand, clay, and silt are found (as described above) and passed to texture.class.numeric.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
texture.class(x, ..., stringsAsFactors = TRUE, validate = TRUE)

## S3 method for class 'character'
texture.class(x, ..., stringsAsFactors = TRUE,
  validate = TRUE)

## S3 method for class 'numeric'
texture.class(x, clay, silt = NULL, ...,
  stringsAsFactors = TRUE, validate = TRUE)

## S3 method for class 'data.frame'
texture.class(x, ..., stringsAsFactors = TRUE,
  validate = TRUE)

Arguments

x

An object to be converted to a vector of texture classes, or a numeric vector describing sand content.

...

Pass to/from methods

stringsAsFactors

Pass TRUE to output a factor vector, FALSE will generate a character vector.

validate

Pass TRUE to ensure output is within the 12 USDA texture classes.

clay

A numeric vector describing relative clay content

silt

A numeric vector describing relative silt content

Value

A factor with levels Cl, ClLo, Lo, LoSa, Sa, SaCl, SaClLo, SaLo, Si, SiCl, SiClLo, or SiLo; or a character vector of the above if stringsAsFactors is FALSE.

Examples

1
texture.class(c("silty clay loam", "sandy clay loam", "s c l", "S C L"))

paleolimbot/soilptf documentation built on May 24, 2019, 6:14 p.m.