Title: | A System of Soil Classification for Making and Interpreting Soil Surveys |
Description: | Taxonomic dictionaries, formative element lists, and functions related to the maintenance, development and application of U.S. Soil Taxonomy. Data and functionality are based on official U.S. Department of Agriculture sources including the latest edition of the Keys to Soil Taxonomy. Descriptions and metadata are obtained from the National Soil Information System or Soil Survey Geographic databases. Other sources are referenced in the data documentation. Provides tools for understanding and interacting with concepts in the U.S. Soil Taxonomic System. Most of the current utilities are for working with taxonomic concepts at the "higher" taxonomic levels: Order, Suborder, Great Group, and Subgroup. |
Version: | 0.2.8 |
Maintainer: | Andrew Brown <andrew.g.brown@usda.gov> |
Depends: | R (≥ 3.5) |
License: | GPL (≥ 3) |
Encoding: | UTF-8 |
LazyLoad: | yes |
Repository: | CRAN |
URL: | https://github.com/ncss-tech/SoilTaxonomy, https://ncss-tech.github.io/SoilTaxonomy/ |
BugReports: | https://github.com/ncss-tech/SoilTaxonomy/issues |
Imports: | stats, utils, stringr, data.table |
Suggests: | testthat, knitr, rmarkdown, markdown, soilDB, ape, data.tree |
RoxygenNote: | 7.3.2 |
VignetteBuilder: | knitr |
LazyData: | false |
NeedsCompilation: | no |
Packaged: | 2025-07-11 04:45:14 UTC; Andrew.G.Brown |
Author: | Andrew Brown [aut, cre], Dylan Beaudette [aut] |
Date/Publication: | 2025-07-11 05:00:06 UTC |
SoilTaxonomy: A System of Soil Classification for Making and Interpreting Soil Surveys
Description
Taxonomic dictionaries, formative element lists, and functions related to the maintenance, development and application of U.S. Soil Taxonomy. Data and functionality are based on official U.S. Department of Agriculture sources including the latest edition of the Keys to Soil Taxonomy. Descriptions and metadata are obtained from the National Soil Information System or Soil Survey Geographic databases. Other sources are referenced in the data documentation. Provides tools for understanding and interacting with concepts in the U.S. Soil Taxonomic System. Most of the current utilities are for working with taxonomic concepts at the "higher" taxonomic levels: Order, Suborder, Great Group, and Subgroup.
Author(s)
Maintainer: Andrew Brown andrew.g.brown@usda.gov
Authors:
Dylan Beaudette dylan.beaudette@usda.gov
See Also
Useful links:
Report bugs at https://github.com/ncss-tech/SoilTaxonomy/issues
Identify formative elements in taxon names at Soil Order, Suborder, Great Group or Subgroup level
Description
Identify formative elements in taxon names at Soil Order, Suborder, Great Group or Subgroup level
Usage
FormativeElements(x, level = c("order", "suborder", "greatgroup", "subgroup"))
OrderFormativeElements(x)
SubOrderFormativeElements(x)
GreatGroupFormativeElements(x)
SubGroupFormativeElements(x)
get_ST_formative_elements(
level = c("order", "suborder", "greatgroup", "subgroup")
)
Arguments
x |
A character vector containing subgroup-level taxonomic names |
level |
one of |
Value
A list containing $defs
: a data.frame
containing taxonomic elements, derivations, connotations and links. And $char.index
: a numeric denoting the position where the formative element occurs in the search text x
get_ST_formative_elements()
: a data.frame containing descriptors of formative elements used at the specified level
Author(s)
D.E. Beaudette, A.G. Brown
Examples
FormativeElements("acrudoxic plinthic kandiudults", level = "subgroup")
SubGroupFormativeElements("acrudoxic plinthic kandiudults")
FormativeElements("acrudoxic plinthic kandiudults", level = "greatgroup")
GreatGroupFormativeElements("acrudoxic plinthic kandiudults")
FormativeElements("acrudoxic plinthic kandiudults", level = "suborder")
SubOrderFormativeElements("acrudoxic plinthic kandiudults")
FormativeElements("acrudoxic plinthic kandiudults", level = "order")
OrderFormativeElements("acrudoxic plinthic kandiudults")
Soil Taxonomy Hierarchy
Description
The first 4 levels of the US Soil Taxonomy hierarchy (soil order, suborder, greatgroup, subgroup), presented as a data.frame
(denormalized) and a list
of unique taxa.
Usage
data(ST)
Format
An object of class data.frame
with 2665 rows and 9 columns.
Details
Ordered based on the unique letter codes denoting taxa from the 13th edition of the Keys to Soil Taxonomy.
References
Soil Survey Staff. 1999. Soil taxonomy: A basic system of soil classification for making and interpreting soil surveys. 2nd edition. Natural Resources Conservation Service. U.S. Department of Agriculture Handbook 436. https://www.nrcs.usda.gov/resources/guides-and-instructions/soil-taxonomy
Soil Survey Staff. 2014. Keys to Soil Taxonomy, 12th ed. USDA-Natural Resources Conservation Service, Washington, DC. https://www.nrcs.usda.gov/resources/guides-and-instructions/keys-to-soil-taxonomy
Soil Moisture Regimes used in the Keys to Soil Taxonomy (13th Edition)
Description
A data.frame containing taxon codes and the Soil Moisture Regime associated with that taxon.
Usage
data(ST_SMR_13th)
Format
An object of class data.frame
with 3082 rows and 2 columns.
Details
Future revisions of this data set may additionally include the Soil Moisture Subclass.
References
S. W. Buol and R. C. Graham and P. A. McDaniel and R. J. Southard. Soil Genesis and Classification, 5th edition. Iowa State Press, 2003.
Keys to Soil Taxonomy Criteria (13th Edition)
Description
A lookup table relating taxon codes to specific criteria from the Keys to Soil Taxonomy (13th Edition)
Usage
data(ST_criteria_13th)
Format
An object of class list
of length 3153.
Details
A list
containing one element per taxon code at order to subgroup level.
Each element contains a data.frame
with 1 row per criterion, and 8 columns:
Each data.frame
contains the following columns:
-
content
(text content of criterion) -
chapter
(chapter number) -
page
(page number) -
key
(key name or level) -
taxon
(taxon name) -
code
(taxon code) -
clause
(sequence number of criterion within taxon) -
logic
(logical meaning of criterion)One of:
-
FIRST
(first) -
OR
(either this criterion OR the next criterion at same level) -
END
(end of hierarchical key) -
NEW
(go to new page/taxon specified) -
AND
(this criterion AND the next criterion at same level) -
HAVE
(criteria that must be met) -
LAST
(end of subgroup key)
-
References
Soil Survey Staff. 2022. Keys to Soil Taxonomy, 13th ed. USDA-Natural Resources Conservation Service. https://www.nrcs.usda.gov/resources/guides-and-instructions/keys-to-soil-taxonomy
Family-level Classes for Soil Taxonomy
Description
A database of family-level class names for Soil Taxonomy.
Usage
data(ST_family_classes)
Format
An object of class data.frame
with 194 rows and 8 columns.
References
Soil Survey Staff. 2014. Keys to Soil Taxonomy, 12th ed. USDA-Natural Resources Conservation Service, Washington, DC. https://www.nrcs.usda.gov/resources/guides-and-instructions/keys-to-soil-taxonomy
Epipedons, Diagnostic Horizons, Characteristics and Features in Soil Taxonomy
Description
A data.frame
with columns "group", "name", "chapter", "page", "description", "criteria". Currently page numbers and contents are referenced to 12th Edition Keys to Soil Taxonomy and derived from products in the ncss-tech SoilKnowledgeBase repository (https://github.com/ncss-tech/SoilKnowledgeBase).
Usage
data(ST_features)
Format
An object of class data.frame
with 84 rows and 6 columns.
References
Soil Survey Staff. 2014. Keys to Soil Taxonomy, 12th ed. USDA-Natural Resources Conservation Service, Washington, DC. https://www.nrcs.usda.gov/resources/guides-and-instructions/keys-to-soil-taxonomy
Formative Elements used by Soil Taxonomy
Description
A database of formative elements used by the first 4 levels of US Soil Taxonomy hierarchy (soil order, suborder, greatgroup, subgroup).
Usage
data(ST_formative_elements)
Format
An object of class list
of length 4.
References
S. W. Buol and R. C. Graham and P. A. McDaniel and R. J. Southard. Soil Genesis and Classification, 5th edition. Iowa State Press, 2003.
Letter Code Lookup Table for Position of Taxa within the Keys to Soil Taxonomy (12th Edition)
Description
A lookup table mapping unique taxonomic Order, Suborder, Great Group and Subgroups to letter codes that denote their logical position within the Keys.
Usage
data(ST_higher_taxa_codes_12th)
Format
An object of class data.frame
with 3082 rows and 2 columns.
Details
The lookup table has been corrected to reflect errata that were posted after the print publication of the 12th Edition Keys, as well as typos in the Spanish language edition.
References
Soil Survey Staff. 2014. Keys to Soil Taxonomy, 12th ed. USDA-Natural Resources Conservation Service, Washington, DC. https://www.nrcs.usda.gov/resources/guides-and-instructions/keys-to-soil-taxonomy
Soil Survey Staff. 2014. Claves para la TaxonomÃa de Suelos, 12th ed. USDA-Natural Resources Conservation Service, Washington, DC. https://www.nrcs.usda.gov/resources/guides-and-instructions/keys-to-soil-taxonomy
Letter Code Lookup Table for Position of Taxa within the Keys to Soil Taxonomy (13th Edition)
Description
A lookup table mapping unique taxonomic Order, Suborder, Great Group and Subgroups to letter codes that denote their logical position within the Keys.
Usage
data(ST_higher_taxa_codes_13th)
Format
An object of class data.frame
with 3153 rows and 2 columns.
References
Soil Survey Staff. 2022. Keys to Soil Taxonomy, 13th ed. USDA-Natural Resources Conservation Service. https://www.nrcs.usda.gov/resources/guides-and-instructions/keys-to-soil-taxonomy
Get (Ordered) Factors based on Soil Taxonomy Key position
Description
Get (Ordered) Factors based on Soil Taxonomy Key position
Usage
SoilTaxonomyLevels(
level = c("order", "suborder", "greatgroup", "subgroup"),
as.is = FALSE,
ordered = TRUE
)
SoilMoistureRegimeLevels(as.is = FALSE, ordered = TRUE)
SoilTemperatureRegimeLevels(as.is = FALSE, ordered = TRUE)
Arguments
level |
One of: |
as.is |
Return character labels rather than an (ordered) factor? Default: |
ordered |
Create an ordinal factor? Default: |
Value
an (ordered) factor or character vector (when as.is=TRUE
)
Examples
SoilTaxonomyLevels("order")
SoilTaxonomyLevels("order", ordered = FALSE)
SoilTaxonomyLevels("order", as.is = TRUE)
SoilTaxonomyLevels("suborder")
World Reference Base for Soil Resources (4th Edition, 2022)
Description
World Reference Base for Soil Resources (4th Edition, 2022)
Usage
data(WRB_4th_2022)
Format
An object of class list
of length 3.
Details
A list containing three data.frame elements "rsg"
, "pq"
, and "sq"
providing information on the 'Representative Soil Groups', 'Principal
Qualifiers,' and 'Supplementary Qualifiers,' respectively.
Each element has the column "code"
which is a number (1-32) referring to
the position in the Reference Soil Groups, and the column
"reference_soil_group"
which is the corresponding group name. The "pq"
and "sq"
qualifier name columns (primary_qualifier
and
supplementary_qualifier
) contain individual qualifier terms. Related
qualifiers are identified using qualifier_group
column derived from
qualifier names separated with a forward slash " / "
The data.frame
"rsg"
has column"criteria"
, describing the logical criteria for each Reference Soil Group.The data.frame
"pq"
has qualifier names in column"principal_qualifier"
The data.frame
"sq"
has column"supplementary_qualifier"
.
References
IUSS Working Group WRB. 2022. World Reference Base for Soil Resources. International soil classification system for naming soils and creating legends for soil maps. 4th edition. International Union of Soil Sciences (IUSS), Vienna, Austria.
Determine taxonomic level of a taxonomic letter code
Description
Determine taxonomic level of a taxonomic letter code
Usage
code_to_level(code)
Arguments
code |
A character vector of taxon codes (case sensitive) |
Value
A character vector containing "order"
, "suborder"
, "greatgroup"
or "subgroup"
Examples
# order level code (1 character)
code_to_level("B")
# subgroup level code (4 characters)
code_to_level("ABCD")
# subgroup level code (5 characters, 4 uppercase + 1 lowercase)
code_to_level("IFFZh")
Decompose taxon letter codes
Description
Find all codes that logically comprise the specified codes. For instance, code "ABC" ("Anhyturbels") returns "A" ("Gelisols"), "AB" ("Turbels"), "ABC" ("Anhyturbels"). Use in conjunction with a lookup table that maps Order, Suborder, Great Group and Subgroup taxa to their codes (see taxon_code_to_taxon
and taxon_to_taxon_code
).
Usage
decompose_taxon_code(codes)
Arguments
codes |
A character vector of taxon codes to "decompose" – case sensitive |
Details
Accounts for Keys that run out of capital letters (more than 26 subgroups) and use lowercase letters for a unique subdivision within the "fourth character position."
Value
A list with equal length to input vector; one character vector per element
See Also
preceding_taxon_codes
, taxon_code_to_taxon
, taxon_to_taxon_code
Examples
decompose_taxon_code(c("ABC", "ABCDe", "BCDEf"))
Explain a taxon name using formative elements
Description
Explain a taxon name using formative elements
Usage
explainST(x, format = c("text", "html"), viewer = TRUE)
Arguments
x |
a Subgroup, Great Group, Suborder or Order-level taxonomic name; matching is exact and case-insensitive |
format |
output format: 'text' | 'html' |
viewer |
show |
Value
a block of text, suitable for display in fixed-width font
Examples
cat(explainST("ids"), "\n\n") # -ids (order suffix)
cat(explainST("aridisols"), "\n\n") # Aridisols (order name)
cat(explainST("argids"), "\n\n") # Arg- (suborder)
cat(explainST("haplargids"), "\n\n") # Hap- (great group)
cat(explainST("typic haplargids"), "\n\n") # Typic (subgroup)
Extract Soil Moisture Regime from Subgroup or Higher Level Taxon
Description
Extract Soil Moisture Regime from Subgroup or Higher Level Taxon
Usage
extractSMR(taxon, as.is = FALSE, droplevels = FALSE, ordered = TRUE)
Arguments
taxon |
character. Vector of taxon names. |
as.is |
Return character labels rather than an (ordered) factor? Default: |
droplevels |
Drop unused levels? Default: |
ordered |
Create an ordinal factor? Default: |
Value
an (ordered) factor of Soil Moisture Regimes, or character vector when as.is=TRUE
Examples
extractSMR(c("aquic haploxeralfs", "typic epiaqualfs", "humic inceptic eutroperox"))
Get the lower (child) taxa for a taxon name or code
Description
Get the lower (child) taxa for a taxon name or code
Usage
getChildTaxa(
taxon = NULL,
code = NULL,
convert = TRUE,
level = c("order", "suborder", "greatgroup", "subgroup")
)
Arguments
taxon |
A character vector of taxa (case-insensitive) |
code |
A character vector of taxon codes (case sensitive) |
convert |
Convert results from taxon codes to taxon names? Default: TRUE |
level |
Filter results to specific level? Default: |
Value
A named list, where names are taxon codes and values are character vectors representing parent taxa
Examples
# suborder children of "Mollisols"
getChildTaxa("Mollisols", level = "suborder")
# get all children within a great group, given a subgroup
getChildTaxa(getTaxonAtLevel("Ultic Haploxeralfs", "greatgroup"))
Get last child taxon in Keys at specified taxonomic level
Description
Get last child taxon in Keys at specified taxonomic level
Usage
getLastChildTaxon(level = c("order", "suborder", "greatgroup"))
Arguments
level |
Get child taxa from keys at specified level. One of: |
Value
A data.frame
containing key
(parent key), taxon
(last taxon name), code
(letter code), position
(relative taxon position)
Examples
# get last taxa in suborder-level keys
x <- getLastChildTaxon(level = "suborder")
# proportion of keys where last taxon has "Hap" formative element
prop.table(table(grepl("^Hap", x$taxon)))
Get the higher (parent) taxa for a taxon name or code
Description
Must specify either taxon
or code
. taxon
is used if both are specified.
Usage
getParentTaxa(
taxon = NULL,
code = NULL,
convert = TRUE,
level = c("order", "suborder", "greatgroup", "subgroup")
)
Arguments
taxon |
A character vector of taxa (case-insensitive) |
code |
A character vector of taxon codes (case sensitive) |
convert |
Convert results from taxon codes to taxon names? Default: |
level |
level Filter results to specific level? Default: |
Value
A named list, where names are taxon codes and values are character vectors representing parent taxa
Examples
getParentTaxa("ultic haploxeralfs")
getParentTaxa(code = c("ABCD", "DABC"))
getParentTaxa("folists", convert = FALSE)
Get the taxon name at the Soil Order, Suborder, Great Group or Subgroup level
Description
Get the taxon name at the Soil Order, Suborder, Great Group or Subgroup level
Usage
getTaxonAtLevel(x, level = "order", simplify = TRUE)
Arguments
x |
A character vector containing subgroup-level taxonomic names |
level |
one of |
simplify |
Return a vector when |
Value
A named character vector of taxa at specified level, where names are the internal Soil Taxonomy letter codes. When length(level) > 1
? a data.frame is returned with column names for each level
.
Examples
# default gets the soil order
getTaxonAtLevel(c("typic haplargids", "typic glacistels")) #, level = "order")
# specify alternate levels
getTaxonAtLevel("humic haploxerands", level = "greatgroup")
# can't get subgroup (child) from great group (parent)
getTaxonAtLevel("udifolists", level = "subgroup")
# but can do parents of children
getTaxonAtLevel("udifolists", level = "suborder")
# specify multiple levels (returns a list element for each level)
getTaxonAtLevel("hapludolls", c("order", "suborder", "greatgroup", "subgroup"))
Get Taxon Criteria from the Keys to Soil Taxonomy
Description
Get Taxon Criteria from the Keys to Soil Taxonomy
Usage
getTaxonCriteria(
taxon = NULL,
code = NULL,
level = c("order", "suborder", "greatgroup", "subgroup")
)
Arguments
taxon |
character. Vector of taxon names (order to subgroup level). These values are converted to taxon "codes" |
code |
character. Vector of taxon codes. |
level |
character. One or more of: "order", "suborder", "greatgroup", "subgroup" |
Value
A named list. Each list element is named based on the input value (either taxon
or code
) and contains a data.frame derived from dataset ST_criteria_13th.
See Also
taxon_to_taxon_code()
, ST_criteria_13th
Examples
getTaxonCriteria(c("mollic haplocryalfs", "abruptic durixeralfs"))
getTaxonCriteria(code = "ABC", level = c("greatgroup"))
Lookup Pre-calculated Soil Moisture Regimes by Taxon
Description
Helper function for using latest version of the Keys to Soil Taxonomy standard lookup table for soil moisture information.
Usage
getTaxonSMR(
taxon = NULL,
code = NULL,
as.is = FALSE,
droplevels = FALSE,
ordered = TRUE
)
Arguments
taxon |
character. Vector of taxon names (order to subgroup level). These values are converted to taxon "codes" |
code |
character. Vector of taxon codes. |
as.is |
logical. Return character labels rather than an (ordered)
factor? Default: |
droplevels |
logical. Drop unused levels? Default: |
ordered |
logical. Create an ordinal factor? Default: |
Value
character or factor (when as.is=FALSE) containing soil moisture
regime labels extracted from 13th edition Keys to Soil Taxonomy taxa using
extractSMR()
See Also
Examples
getTaxonSMR(c("aridisols", "haploxeralfs", NA, "abruptic durixeralfs", "ustic haplocryalfs"))
Get soil family / series differentiae and class names
Description
All parameters to this function are optional (default NULL
). If specified, they are used as filters.
Usage
get_ST_family_classes(
classname = NULL,
group = NULL,
name = NULL,
chapter = NULL,
page = NULL,
multiline_sep = "\n",
multiline_col = "criteria"
)
Arguments
classname |
optional filtering vector; levels of |
group |
optional filtering vector; one or more of: |
name |
optional filtering vector; one or more of: |
chapter |
optional filtering vector for chapter number |
page |
optional filtering vector; page number (12th Edition Keys to Soil Taxonomy) |
multiline_sep |
default |
multiline_col |
character. vector of "multi-line" column names to concatenate. Default: |
Details
This is a wrapper method around the package data set ST_family_classes
.
Value
a data.frame
a subset of ST_family_classes
data.frame
See Also
ST_family_classes
ST_features
get_ST_features()
Examples
# get classes in chapter 17
str(get_ST_family_classes(chapter = 17))
# get classes on page 323
get_ST_family_classes(page = 323)
# get the description for the mesic temperature class from list column
str(get_ST_family_classes(classname = "mesic")$description)
Get soil diagnostic horizons, characteristics and features
Description
All parameters to this function are optional (default NULL
). If specified, they are used as filters.
Usage
get_ST_features(
group = NULL,
chapter = NULL,
name = NULL,
page = NULL,
multiline_sep = "\n",
multiline_col = "criteria"
)
Arguments
group |
optional filtering vector; one of: |
chapter |
optional filtering vector for chapter number |
name |
optional filtering vector; these are the "names" of features used in headers |
page |
optional filtering vector; page number (12th Edition Keys to Soil Taxonomy) |
multiline_sep |
default |
multiline_col |
character. vector of "multi-line" column names to concatenate. Default: |
Details
This is a wrapper method around the package data set ST_features
.
Value
a subset of ST_features
data.frame
See Also
ST_features
ST_family_classes
get_ST_family_classes()
Examples
# get all features
str(get_ST_features())
# get features in chapter 3
str(get_ST_features(chapter = 3))
# get features on pages 18, 19, 20
get_ST_features(page = 18:20)
# get the required characteristics for the mollic epipedon from list column
str(get_ST_features(name = "Mollic Epipedon")$criteria)
Check for valid taxonomic level (Order, Suborder, Great Group, Subgroup)
Description
Checks needle
for matches against a single level of Soil Taxonomy hierarchy: order
, suborder
, greatgroup
, subgroup
. Matches are case-insensitive.
Usage
isValidST(needle, level = c("order", "suborder", "greatgroup", "subgroup"))
Arguments
needle |
vector of taxa |
level |
single level of Soil Taxonomy hierarchy; one of: |
Value
logical
vector, same length as needle
Examples
isValidST('typic haploxeralfs', level = 'subgroup')
Order of Hierarchical Levels in Soil Taxonomy
Description
Creates an ordered factor such that different levels (the values used in level
arguments to various SoilTaxonomy package functions) in the Soil Taxonomy hierarchy can be distinguished or compared to one another.
Usage
level_hierarchy(
x = c("order", "suborder", "greatgroup", "subgroup", "family"),
family = TRUE,
as.is = FALSE
)
Arguments
x |
Passed as input to |
family |
Allow |
as.is |
Return |
Details
The levels of Soil Taxonomy hierarchy include: "family"
, "subgroup"
, "greatgroup"
, "suborder"
, "order"
. The "order"
is a level above "suborder"
. "subgroup"
and above are "taxa above family"
. Note: "family"
is always included as the "lowest" level when the result is an ordered factor, even when family-level input is disallowed by family=FALSE
.
Value
An ordered factor with the values "order", "suborder", "greatgroup", "subgroup". or character when as.is=TRUE
.
Examples
# is great group a taxon above family?
level_hierarchy("greatgroup") > "family"
# is order lower level than suborder?
level_hierarchy("order") < "suborder"
# what levels are above or equal to a particular taxon's level?
level_hierarchy(as.is = TRUE)[level_hierarchy() >= taxon_to_level("aquisalids")]
## this produces an error (used for checking for taxa above family)
# level_hierarchy("family", family = FALSE)
Get all taxa at specified level
Description
Convenience method for getting taxa from ST_unique_list
Usage
level_to_taxon(level = c("order", "suborder", "greatgroup", "subgroup"))
Arguments
level |
character. One or more of "order", "suborder", "greatgroup", "subgroup" |
Value
A character vector of taxa at the specified level
Examples
# get all order and suborder level taxa
level_to_taxon(level = c("order","suborder"))
Generate Newick Tree Format Parenthetic Strings
Description
This function generates Newick tree format strings for a single tree. Taxa are assigned relative positions within their parent to indicate the order that they "key out."
Usage
newick_string(
x = NULL,
level = c("suborder", "greatgroup", "subgroup"),
what = c("taxon", "code")
)
Arguments
x |
Optional: a taxon name to get children of. |
level |
Level to build the tree at. One of |
what |
Either |
Details
The output from this function is a character string with parenthetical format encoding a single tree suitable for input into functions such as ape::read.tree()
. Multiple trees can be combined together in the file or text string supplied to your tree-parsing function of choice.
Value
character. A single tree in parenthetical Newick or New Hampshire format.
Examples
if (requireNamespace("ape")) {
par(mar = c(0, 0, 0, 0))
# "fan"
mytr <- ape::read.tree(text = newick_string(level = "suborder"))
plot(mytr, "f", rotate.tree = 180, cex = 0.75)
# "cladogram"
mytr <- ape::read.tree(text = newick_string("durixeralfs", level = "subgroup"))
plot(mytr, "c")
# "cladogram" (using taxon codes instead of subgroups)
mytr <- ape::read.tree(text = newick_string("xeralfs", level = "subgroup", what = "code"))
plot(mytr, "c")
dev.off()
}
Parent/Child Hierarchy
Description
Parent/Child Hierarchy
Usage
parent_level(level, n = 1)
child_level(level, n = 1)
Arguments
level |
character. Initial level name of a taxon. Vectors include values that are one of: |
n |
Number of levels above/below (parent/child). Default: |
Value
character. Level name of parent or child at specified level above input level
.
Examples
parent_level('subgroup')
child_level('greatgroup')
parent_level('family', 3)
# no level above order
parent_level('family', 5)
Parse components of a "family-level" taxon name
Description
Parse components of a "family-level" taxon name
Usage
parse_family(family, column_metadata = TRUE, flat = TRUE)
Arguments
family |
character. vector of taxonomic families, e.g. |
column_metadata |
logical. include parsed NASIS physical column names and values from family taxon components? Default: |
flat |
logical Default: |
Value
a data.frame
containing column names: "family"
(input), "subgroup"
(parsed taxonomic subgroup), "subgroup_code"
(letter code for subgroup), "class_string"
(comma-separated family classes), "classes_split"
(split class_string
vector stored as list
column).
In addition, the following column names are identified and returned based on NASIS (National Soil Information System) metadata (via soilDB package):
-
"taxpartsize"
,"taxpartsizemod"
,"taxminalogy"
,"taxceactcl"
,"taxreaction"
,"taxtempcl"
,"taxfamhahatmatcl"
,"taxfamother"
,"taxsubgrp"
,"taxgreatgroup"
,"taxsuborder"
,"taxorder"
Examples
if (requireNamespace('soilDB')) {
families <- c("fine, kaolinitic, thermic typic kanhapludults",
"fine-loamy, mixed, semiactive, mesic ultic haploxeralfs",
"euic, thermic typic haplosaprists",
"coarse-loamy, mixed, active, mesic aquic dystrudepts")
# inspect parsed list result
str(parse_family(families))
}
Get taxon codes of preceding taxa
Description
Find all codes that logically precede the specified codes. For instance, code "ABC" ("Anhyturbels") returns "AA" ("Histels") "ABA" ("Histoturbels") and "ABB" ("Aquiturbels"). Use in conjunction with a lookup table that maps Order, Suborder, Great Group and Subgroup taxa to their codes (see taxon_code_to_taxon
and taxon_to_taxon_code
).
Usage
preceding_taxon_codes(codes)
Arguments
codes |
A character vector of codes to calculate preceding codes for |
Details
Accounts for Keys that run out of capital letters (more than 26 subgroups) and use lowercase letters for a unique subdivision within the "fourth character position."
Value
A list with equal length to input vector; one character vector per element
See Also
decompose_taxon_code
, taxon_code_to_taxon
, taxon_to_taxon_code
Examples
preceding_taxon_codes(c("ABCDe", "BCDEf"))
Determine relative position of taxon within Keys to Soil Taxonomy (Order to Subgroup)
Description
The relative position of a taxon is [number of preceding Key steps] + 1
, or NA
if it does not exist in the lookup table.
Usage
relative_taxon_code_position(code)
Arguments
code |
A character vector of taxon codes to determine the relative position of. |
Value
A numeric vector with the relative position of each code with respect to their individual Keys.
Examples
# "ABCD" -> "Gypsic Anhyturbels", relative position 7
# "WXYZa" does not exist, theoretical position is 97
# "BAD" -> "Udifolists", relative position is 5
relative_taxon_code_position(c("ABCD", "WXYZa", "BAD"))
# [1] 7 NA 5
Create a data.tree
Object from Taxon Names
Description
This function takes one or more taxon names and taxonomic levels as input.
Usage
taxonTree(
taxon,
level = c("order", "suborder", "greatgroup", "subgroup"),
root = "Soil Taxonomy",
verbose = TRUE,
special.chars = c("|--", "|", "|", "-"),
file = "",
...
)
Arguments
taxon |
A vector of taxon names |
level |
One or more of: |
root |
Label for root node. Default: |
verbose |
Print tree output? Default: |
special.chars |
Characters used to print the tree to console. Default: |
file |
Optional: path to output file. Default: |
... |
Additional arguments to |
Details
A subclass of data.tree Node
object is returned. This object has a custom print()
method
Value
A SoilTaxonNode
(subclass of data.tree
Node
) object (invisibly). A text representation of the tree is printed to stdout when verbose=TRUE
.
Examples
# hapludults and hapludalfs (to subgroup level)
taxonTree(c("hapludults", "hapludalfs"))
# alfisols suborders and great groups
taxonTree("alfisols", root = "Alfisols", level = c("suborder", "greatgroup"))
Convert taxon code to taxon name
Description
Convert taxon code to taxon name
Usage
taxon_code_to_taxon(code)
Arguments
code |
A character vector of Taxon Codes |
Value
A character vector of matching Taxon Names
See Also
decompose_taxon_code
, preceding_taxon_codes
, taxon_to_taxon_code
Examples
taxon_code_to_taxon(c("ABC", "XYZ", "DAB", NA))
Determine taxonomic level of specified taxa
Description
Taxa that resolve to a subgroup level taxon and contain a comma ","
are assumed to be "family"
-level.
Usage
taxon_to_level(taxon)
Arguments
taxon |
character vector of taxon names at Order, Suborder, Great Group or Subgroup level. |
Value
character of taxonomic hierarchy levels (such as "order", "suborder", "greatgroup", "subgroup", "family") for each element of input vector.
Examples
# get the taxonomic levels for various taxa
taxon_to_level(c("gelisols", NA, "foo", "typic folistels", "folistels"))
Convert taxon name to taxon code
Description
Convert taxon name to taxon code
Usage
taxon_to_taxon_code(taxon)
Arguments
taxon |
A character vector of taxon names, case insensitive |
Value
A character vector of matching taxon codes
See Also
decompose_taxon_code
, preceding_taxon_codes
, taxon_code_to_taxon
Examples
taxon_to_taxon_code(c("Anhyturbels", "foo", "Cryaquands", NA))