This function generates a very specific output using a very specific input: soil profile sketches positioned near the terminal nodes of a dendrogram. Soil profile sketches are created from the SoilProfileCollection object specified via spc argument, using aqp::plotSPC(). The dendrogram is created by hierarchical clustering of a distance matrix, developed from soil classification data (site-level attributes of spc) as specified in levels. This function was developed and tested with the intention that soil classification data specified in levels is the top four levels of Soil Taxonomy. If available, it is possible to use two or more levels of any hierarchical classification system.
When using taxa from Soil Taxonomy it is possible to interpret levels as ordered factors, based on the order in which taxa "key out" in the 13th edition of The Keys to Soil Taxonomy (KST.order = TRUE). Setting KST.order = FALSE will encode taxa levels as a nominal factors. This will have a large impact on calculated distances. The allLevels and wt arguments can be used to further customize the determination of pair-wise distances.
SoilTaxonomyDendrogram(
spc,
KST.order = TRUE,
allLevels = FALSE,
rotationOrder = NULL,
level = c(soilorder = "soilorder", suborder = "suborder", greatgroup = "greatgroup",
subgroup = "subgroup"),
wt = c(1, 1, 1, 1),
cluster.method = c("divisive", "agglomerative"),
cluster.args = list(),
name = "hzname",
name.style = "center-center",
id.style = "side",
n.depth.ticks = 6,
scaling.factor = 0.015,
cex.names = 0.75,
cex.id = 0.75,
width = 0.25,
y.offset = 0.5,
shrink = FALSE,
font.id = 2,
cex.taxon.labels = 0.66,
font.taxon.labels = 3,
dend.color = par("fg"),
dend.width = 1,
dend.type = c("phylogram", "cladogram"),
max.depth = ifelse(is.infinite(max(spc)), 200, max(spc)),
...
)a SoilProfileCollection object, typically returned by soilDB::fetchOSD()
logical, encode / cluster taxa via ordinal factors, based on ordering within Keys to Soil Taxonomy.
logical, use the full set of taxa from Keys to Soil Taxonomy (TRUE), or just those present in spc (FALSE).
character vector of profile IDs with desired ordering of leaves in the dendrogram from left to right; exact ordering is not always possible
character. One or more site-level columns in spc. Default: "soilorder", "suborder", "greatgroup" and "subgroup"
numeric vector, same length as level, weighting for levels of classification, passed to cluster::daisy(), see details
Either "divisive" (cluster::diana(); default) or "agglomerative" (cluster::agnes())
Optional: additional arguments for [cluster::diana() or cluster::agnes() cluster methods
column name containing horizon names
passed to aqp::plotSPC()
passed to aqp::plotSPC()
suggested number of ticks on the depth axis
scaling factor used to convert depth units into plotting units
character scaling for horizon names
character scaling for profile IDs
width of profiles
vertical offset between dendrogram and profiles
logical, should long horizon names be shrunk by 80% ?
integer, font style applied to profile id, default is 2 (bold)
numeric, character scaling for taxonomic information
integer, font style applied to taxa labels, default is 3 (italic)
dendrogram line color
dendrogram line width
dendrogram type, passed to plot.phylo(), either "phylogram" or "cladogram"
depth at which profiles are truncated for plotting
additional arguments to aqp::plotSPC
An invisibly-returned list containing:
dist: pair-wise dissimilarity matrix
order: final ordering of hclust leaves
This function looks for specific site-level attributes named: "soilorder", "suborder", "greatgroup", and "subgroup", or their NASIS physical column name analogues "taxorder", "taxsuborder", "taxgrtgroup", and "taxsubgrp". See https://github.com/ncss-tech/sharpshootR/blob/master/misc/soilTaxonomyDendrogram-examples.R for some examples.
The rotationOrder argument uses ape::rotateConstr() to reorder leaves within the hclust representation of the ST hierarchy. Perfect sorting is not always possible.
Weighting levels of Soil Taxonomy will only have an effect when KST.order = TRUE. Weights supplied via wt will have a small, but noticeable effect on the resulting distance matrix and hierarchical clustering.
Reasonable default arguments to aqp::plotSPC() are used in the default arguments to this function. Given the wide range in output device settings and number of profiles in spc, you may need to make adjustments. The scaling.factor and y.offset arguments are the most common place where adjustments will be required. The max.depth argument cane be used to truncate deeper profiles with a ragged bottom effect, helpful when there is a wide range in profile depth within spc. See the aqp::plotSPC() manual page for additional ways in which sketches and the depth axis can be adjusted.