Skip to content

Commit 5c7fbeb

Browse files
bump
1 parent fa1ee45 commit 5c7fbeb

File tree

4 files changed

+86
-88
lines changed

4 files changed

+86
-88
lines changed

AQP/aqp/gen-hz-assignment.Rmd

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ output:
1111

1212
```{r setup, echo=FALSE, results='hide', warning=FALSE}
1313
library(knitr, quietly = TRUE)
14-
opts_chunk$set(message=FALSE, warning=FALSE, out.width="100%", fig.retina = 2, fig.align='center', dev='png', dev.args=list(pointsize=10, antialias='cleartype'), tidy=FALSE)
14+
opts_chunk$set(message=FALSE, warning=FALSE, out.width="100%", fig.retina = 2, fig.align='center', dev='png', tidy=FALSE)
1515
options(width=100, stringsAsFactors=FALSE)
1616
1717
knit_hooks$set(htmlcap = function(before, options, envir) {
@@ -58,26 +58,23 @@ Here is a basic outline of the process:
5858
If you have never used the [aqp](http://ncss-tech.github.io/AQP/aqp/aqp-intro.html) or [soildb](http://ncss-tech.github.io/AQP/soilDB/soilDB-Intro.html) packages before, you will likely need to install them. This only needs to be done once.
5959
```{r install-packages, eval=FALSE}
6060
# stable version from CRAN + dependencies
61-
install.packages('ape', dep=TRUE)
62-
install.packages('latticeExtra', dep=TRUE)
63-
install.packages('plyr', dep=TRUE)
64-
install.packages('aqp', dep=TRUE)
65-
install.packages('soilDB', dep=TRUE)
66-
install.packages('sharpshootR', dep=TRUE)
61+
install.packages('ape')
62+
install.packages('latticeExtra')
63+
install.packages('aqp')
64+
install.packages('soilDB')
65+
install.packages('sharpshootR')
6766
```
6867

6968
Once you have all of the R packages on which this document depends, it is a good idea to load them. R packages must be **installed** anytime you change versions of R (e.g., after an upgrade) and **loaded** anytime you want to access functions from within those packages.
7069

7170
```{r load-packages}
7271
library(aqp)
7372
library(soilDB)
74-
library(sharpshootR)
7573
library(igraph)
7674
library(ape)
7775
library(latticeExtra)
7876
library(lattice)
7977
library(cluster)
80-
library(MASS)
8178
```
8279

8380
# Sample Data
@@ -120,6 +117,8 @@ In this case, [`r names(sort(table(pedons$hzname), decreasing=TRUE))[1:4]`] hori
120117

121118
Constructing a graph of transitions from one horizon to the next ("transition probabilities") can highlight those horizon designations that are most commonly used together. A follow-up tutorial on transition probability matrix interpretation is planned.
122119
```{r transition-probabilities, fig.width=6, fig.height=6, out.width="80%", htmlcap='Graph constructed from transition probabilities.'}
120+
library(sharpshootR)
121+
123122
tp <- hzTransitionProbabilities(pedons, 'hzname')
124123
par(mar = c(1, 1, 1, 1))
125124
plotSoilRelationGraph(tp, graph.mode = 'directed', edge.arrow.size = 0.5, edge.scaling.factor = 2, vertex.label.cex = 0.75, vertex.label.family = 'sans')
@@ -260,7 +259,7 @@ bwplot(hzdept ~ genhz, data=horizons(s),
260259

261260
### Advanced: Multivariate Soil Property Summary
262261

263-
The evaluation of generalized horizon labels typically requires a review of more information than field-described horizon labels and depth. For example, clay content, sand content, pH, total rock fragment volume, and horizon mid-points are soil properties that can be used to differentiate horizons-- as long as the data are populated. In this document, clay content, total rock fragment volume, and horizon mid-points are used. Multivariate comparisons are commonly based on the concept of [pair-wise dissimilarity](http://hymenoptera.tamu.edu/courses/ento601/pdf/Sokal_1966.pdf) and subsequent reduction of the resulting [distance matrix](http://en.wikipedia.org/wiki/Distance_matrix) into a simpler representation. [Non-metric multidimensional scaling](http://en.wikipedia.org/wiki/Multidimensional_scaling) (nMDS) is one method for reducing the distance matrix into a new set of coordinates in two-dimensional space. A [related](http://ncss-tech.github.io/AQP/aqp/aqp-profile-dissimilarity.html) document explores this idea further.
262+
The evaluation of generalized horizon labels typically requires a review of more information than field-described horizon labels and depth. For example, clay content, sand content, pH, total rock fragment volume, and horizon mid-points are soil properties that can be used to differentiate horizons-- as long as the data are populated. In this document, clay content, total rock fragment volume, and horizon mid-points are used. Multivariate comparisons are commonly based on the concept of [pair-wise dissimilarity](http://hymenoptera.tamu.edu/courses/ento601/pdf/Sokal_1966.pdf) and subsequent reduction of the resulting [distance matrix](http://en.wikipedia.org/wiki/Distance_matrix) into a simpler representation. [Classic multidimensional scaling](http://en.wikipedia.org/wiki/Multidimensional_scaling) (MDS) is one method for reducing the distance matrix into a new set of coordinates in two-dimensional space. A [related](http://ncss-tech.github.io/AQP/aqp/aqp-profile-dissimilarity.html) document explores this idea further.
264263

265264
```{r evaluate-genhz-assignment}
266265
# store the column names of our variables of interest
@@ -279,8 +278,8 @@ pedons$neighbor <- hz.eval$horizons$neighbor
279278
```
280279

281280

282-
In the following figure, generalized horizon labels are plotted at nMDS coordinates as colored circles, along with original horizon designations and pedon IDs. Ideally, groupings of GHL should form relatively homogeneous clusters in this figure; however, there will always be some overlap at the edges. Heterogeneous regions should be inspected in cases where the assigned GHL may not make sense. In this example, the original designation of "Bt3" for pedon ID 09CKS036 does not seem to fit into the "Bt3" generalized horizon. According to the soil properties used (clay content, total rock fragments, horizon mid-point), the horizon may better fit the "Bt2" generalized horizon. In addition, it appears that "Bw" and "BA" horizons can be included into the "A" generalized horizon. Decisions on issues such as this can only be made based on field experience or at least some level of expert knowledge about the soils in question. Once a decision has been made, additions to the GHL rules (e.g. adding "Bw" and "BA" to the "A" GHL) and possibly manual adjustment can be used to accomodate the changes.
283-
```{r mds-plot, fig.width=9, fig.height=9, htmlcap='Horizon designations and GHL as plotted along nMDS axes.'}
281+
In the following figure, generalized horizon labels are plotted at MDS coordinates as colored circles, along with original horizon designations and pedon IDs. Ideally, groupings of GHL should form relatively homogeneous clusters in this figure; however, there will always be some overlap at the edges. Heterogeneous regions should be inspected in cases where the assigned GHL may not make sense. In this example, the original designation of "Bt3" for pedon ID 09CKS036 does not seem to fit into the "Bt3" generalized horizon. According to the soil properties used (clay content, total rock fragments, horizon mid-point), the horizon may better fit the "Bt2" generalized horizon. In addition, it appears that "Bw" and "BA" horizons can be included into the "A" generalized horizon. Decisions on issues such as this can only be made based on field experience or at least some level of expert knowledge about the soils in question. Once a decision has been made, additions to the GHL rules (e.g. adding "Bw" and "BA" to the "A" GHL) and possibly manual adjustment can be used to accomodate the changes.
282+
```{r mds-plot, fig.width=9, fig.height=9, htmlcap='Horizon designations and GHL as plotted along MDS axes.'}
284283
# convert pedons to a data.frame
285284
pedons.df <- as(pedons, 'data.frame')
286285
# plot generalized horizon labels at MDS coordinates

AQP/aqp/gen-hz-assignment.html

Lines changed: 28 additions & 29 deletions
Large diffs are not rendered by default.

AQP/soilDB/competing-series.Rmd

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ smart: no
1414
# setup
1515
library(knitr, quietly=TRUE)
1616
library(kableExtra, quietly=TRUE)
17-
opts_chunk$set(message=FALSE, warning=FALSE, background='#F7F7F7', fig.align='center', dev='svglite', tidy=FALSE, verbose=FALSE)
17+
opts_chunk$set(message=FALSE, warning=FALSE, background='#F7F7F7', fig.align='center', dev='png', tidy=FALSE, verbose=FALSE)
1818
options(width=100, stringsAsFactors=FALSE)
1919
```
2020

@@ -24,7 +24,7 @@ The soil series concept is a practical grouping of soil/landscape patches that r
2424

2525
## Practical Matters
2626

27-
This is rough outline for evalutating potential differences between soil series within the same family, e.g. competing series. For this example, start the process by loading data within the same family as the [Drummer](https://casoilresource.lawr.ucdavis.edu/sde/?series=Drummer) series; *fine-silty, mixed, superactive, mesic typic endoaquolls*.
27+
This is rough outline for evaluating potential differences between soil series within the same family, e.g. competing series. For this example, start the process by loading data within the same family as the [Drummer](https://casoilresource.lawr.ucdavis.edu/sde/?series=Drummer) series; *fine-silty, mixed, superactive, mesic typic endoaquolls*.
2828

2929
Why would a soil scientist do this?
3030

@@ -111,7 +111,7 @@ print(res$fig)
111111
Visualize pair-wise distances using a dendrogram and profile sketches. What do the two main groupings tell us about this family?
112112
```{r fig.width=12, fig.height=6}
113113
par(mar=c(0,0,1,1))
114-
plotProfileDendrogram(s.competing.data$SPC, clust = res$clust, scaling.factor = 0.075, width = 0.2, y.offset = 0.5)
114+
aqp::plotProfileDendrogram(s.competing.data$SPC, clust = res$clust, scaling.factor = 0.075, width = 0.2, y.offset = 0.5)
115115
mtext(fm.name, side = 1, at = 0.5, adj = 0, line = -1.5, font=4)
116116
mtext('sorted by annual climate summaries', side = 3, at = 0.5, adj = 0, line = -1.5, font=3)
117117
```
@@ -208,7 +208,7 @@ dd <- diana(d)
208208
Hang profile sketches from divisive hierarchical clustering of soil color signatures.
209209
```{r fig.width=12, fig.height=5}
210210
par(mar = c(1,0,1,1))
211-
plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 2, scaling.factor = 0.28, y.offset = 2, width=0.2, cex.names=0.45)
211+
aqp::plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 2, scaling.factor = 0.28, y.offset = 2, width=0.2, cex.names=0.45)
212212
213213
# annotate with family name
214214
mtext(fm.name, side = 1, at = 0.5, adj = 0, line = -1, font=4)
@@ -222,7 +222,7 @@ par(mar = c(0,0,0,0), bg = 'black', fg = 'white')
222222
223223
# hang profiles from dendrogram
224224
# note customization via arguments passed to plotSPC
225-
plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 2, scaling.factor = 0.28, y.offset = 2, width=0.4, cex.names=0.45, dend.color = 'white', dend.width = 2, divide.hz=FALSE, print.id=FALSE, depth.axis = FALSE, name=NA, default.color = grey(0.125), max.depth = 210)
225+
aqp::plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 2, scaling.factor = 0.28, y.offset = 2, width=0.4, cex.names=0.45, dend.color = 'white', dend.width = 2, divide.hz=FALSE, print.id=FALSE, depth.axis = FALSE, name=NA, default.color = grey(0.125), max.depth = 210)
226226
227227
# annotate with family name
228228
mtext(fm.name, side = 1, at = 0.5, adj = 0, line = -1, font=4)
@@ -277,23 +277,23 @@ dd <- diana(pd)
277277
Sketches made from moist colors, arranged according to select indices of morphology as extracted from the OSDs. Profiles are truncated at 200cm.
278278
```{r fig.width=10, fig.height=6}
279279
par(mar = c(1,0,1,1))
280-
plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 4, scaling.factor = 0.5, y.offset = 5, width=0.2, cex.names=0.45, max.depth = 200)
280+
aqp::plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 4, scaling.factor = 0.5, y.offset = 5, width=0.2, cex.names=0.45, max.depth = 200)
281281
mtext(fm.name, side = 1, at = 0.5, adj = 0, line = -1, font = 4)
282282
```
283283

284284
Thematic sketches, arranged according to select indices of morphology as extracted from the OSDs. Trends are clear
285285
```{r fig.width=10, fig.height=6}
286286
par(mar = c(1,0,3,1))
287-
plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 4, scaling.factor = 0.5, y.offset = 5, width=0.2, cex.names=0.45, color='texture_class', col.label='Texture Class', max.depth = 200)
287+
aqp::plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 4, scaling.factor = 0.5, y.offset = 5, width=0.2, cex.names=0.45, color='texture_class', col.label='Texture Class', max.depth = 200)
288288
mtext(fm.name, side = 1, at = 0.5, adj = 0, line = -1, font=4)
289289
290-
plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 4, scaling.factor = 0.5, y.offset = 5, width=0.2, cex.names=0.45, color='pH_class', col.label='pH Class', max.depth = 200)
290+
aqp::plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 4, scaling.factor = 0.5, y.offset = 5, width=0.2, cex.names=0.45, color='pH_class', col.label='pH Class', max.depth = 200)
291291
mtext(fm.name, side = 1, at = 0.5, adj = 0, line = -1, font=4)
292292
293-
plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 4, scaling.factor = 0.5, y.offset = 5, width=0.2, cex.names=0.45, color='gley', col.label='Gleyed Horizons', max.depth = 200)
293+
aqp::plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 4, scaling.factor = 0.5, y.offset = 5, width=0.2, cex.names=0.45, color='gley', col.label='Gleyed Horizons', max.depth = 200)
294294
mtext(fm.name, side = 1, at = 0.5, adj = 0, line = -1, font=4)
295295
296-
plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 4, scaling.factor = 0.5, y.offset = 5, width=0.2, cex.names=0.45, color='discontinuity', col.label='Discontinuity', max.depth = 200)
296+
aqp::plotProfileDendrogram(spc, dd, dend.y.scale = max(d) * 4, scaling.factor = 0.5, y.offset = 5, width=0.2, cex.names=0.45, color='discontinuity', col.label='Discontinuity', max.depth = 200)
297297
mtext(fm.name, side = 1, at = 0.5, adj = 0, line = -1, font=4)
298298
```
299299

AQP/soilDB/competing-series.html

Lines changed: 37 additions & 37 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)