You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`SoilProfileCollection` objects are typically created by "promoting" `data.frame` objects (rectangular tables of data) that contain at least three essential columns:
77
77
78
-
1. an ID column uniquely identifying groups of horizons (e.g. pedons)
79
-
2. horizon top boundaries
80
-
3. horizon bottom boundaries
78
+
1. an ID column uniquely identifying groups of horizons (e.g. pedons)
79
+
2. horizon top boundaries
80
+
3. horizon bottom boundaries
81
81
82
82
The `data.frame` is sorted internally according to the profile ID and horizon top boundary. Formula notation is used to define the columns used to promote a `data.frame` object:
"Accessor" functions are used to extract specific components from within `SoilProfileCollection` objects.
120
120
121
-
* Methods that return a column name. These are useful for extracting depths, horizon designations, IDs, etc. before taking an SPC apart for a specific task.
122
-
123
-
+ `idname(sp4)`: extract profile ID name (column name used to init SPC)
124
-
+ `horizonDepths(sp4)`: horizon top / bottom depth names (used to init SPC)
125
-
+ `hzidname(sp4)`: horizon ID name (typically automatically built at init time)
126
-
+ `hzdesgnname(sp4)`: horizon designation name (if set)
127
-
+ `hztexclname(sp4)`: horizon texture class name (if set)
128
-
129
-
* Methods that return a vector of values.
130
-
131
-
+`profile_id(sp4)`: profile IDs, in order
132
-
+`hzID(sp4)`: horizon IDs, in order
133
-
+`hzDesgn(sp4)`: horizon designations, in order
134
-
135
-
* Methods that return site/horizon attribute column names.
136
-
137
-
+`names(sp4)`: site + horizon names concatenated into a single vector
138
-
+`horizonNames(sp4)`: horizon names
139
-
+`siteNames(sp4)`: site names
140
-
141
-
* Profile and horizon totals.
142
-
143
-
+`length(sp4)`: number of profiles in collection
144
-
+`nrow(sp4)`: number of horizons in collection
121
+
* Methods that return a column name. These are useful for extracting depths, horizon designations, IDs, etc. before taking an SPC apart for a specific task.
122
+
123
+
+`idname(sp4)`: extract profile ID name (column name used to init SPC)
124
+
+`horizonDepths(sp4)`: horizon top / bottom depth names (used to init SPC)
125
+
+`hzidname(sp4)`: horizon ID name (typically automatically built at init time)
126
+
+`hzdesgnname(sp4)`: horizon designation name (if set)
127
+
+`hztexclname(sp4)`: horizon texture class name (if set)
128
+
129
+
* Methods that return a vector of values.
130
+
131
+
+`profile_id(sp4)`: profile IDs, in order
132
+
+`hzID(sp4)`: horizon IDs, in order
133
+
+`hzDesgn(sp4)`: horizon designations, in order
145
134
146
-
* Other methods.
147
-
148
-
+`depth_units(sp4)`: defaults to 'cm' at SPC creation
149
-
+`metadata(sp4)`: returns `list` object with base + optional (user-defined) metadata elements
135
+
* Methods that return site/horizon attribute column names.
136
+
137
+
+`names(sp4)`: site + horizon names concatenated into a single vector
138
+
+`horizonNames(sp4)`: horizon names
139
+
+`siteNames(sp4)`: site names
140
+
141
+
* Profile and horizon totals.
142
+
143
+
+`length(sp4)`: number of profiles in collection
144
+
+`nrow(sp4)`: number of horizons in collection
145
+
146
+
* Other methods.
147
+
148
+
+`depth_units(sp4)`: defaults to 'cm' at SPC creation
149
+
+`metadata(sp4)`: returns `list` object with base + optional (user-defined) metadata elements
150
150
151
151
# Horizon and Site Data
152
152
@@ -156,10 +156,10 @@ Both site and horizon data are stored as `data.frame` within the SoilProfileColl
156
156
157
157
Columns from site or horizon tables can be accessed with the `$` syntax notation, similar to the `data.frame`. New data can be assigned to either table in the same manner, as long as the length of the new data is:
158
158
159
-
1. same length as the number of profiles in the collection (target is the site table)
160
-
2. same length as the number of horizons in the collection (target is the horizon table)
161
-
3. length 1; and selecting the target table requires `site(object)$new_column <- new_value` for new site data and `horizons(object)$new_column <- new value` for horizon
162
-
159
+
1. same length as the number of profiles in the collection (target is the site table)
160
+
2. same length as the number of horizons in the collection (target is the horizon table)
161
+
3. length 1; and selecting the target table requires `site(object)$new_column <- new_value` for new site data and `horizons(object)$new_column <- new value` for horizon
162
+
163
163
Assignment of new data to existing or new attributes can proceed as follows.
164
164
165
165
```{r hz_and_site_data}
@@ -355,13 +355,13 @@ z <- rebuildSPC(sp4)
355
355
356
356
`checkHzDepthLogic()` has the ability to perform logical tests on whole profiles or individual horizons. Four different tests are performed related to four common errors in horizon depths:
357
357
358
-
- bottom depth shallower than top depth
358
+
- bottom depth shallower than top depth
359
359
360
-
- equal top and bottom depth
360
+
- equal top and bottom depth
361
361
362
-
- missing (`NA`) top or bottom depth
362
+
- missing (`NA`) top or bottom depth
363
363
364
-
- gap or overlap between adjacent horizons
364
+
- gap or overlap between adjacent horizons
365
365
366
366
```{r}
367
367
checkHzDepthLogic(sp4)
@@ -445,7 +445,7 @@ sp4[, , .LAST]
445
445
`SoilProfileCollection` objects are combined by passing a list of objects to the `combine()` function.
446
446
447
447
Ideally all objects share the same internal structure, profile ID, horizon ID, depth units, and other parameters of a `SoilProfileCollection`. Manually subset the example data into 3 pieces, compile into a list, and then `combine` back together.
448
-
448
+
449
449
```{r concatenation, eval=FALSE}
450
450
# subset data into chunks
451
451
s1 <- sp4[1:2, ]
@@ -636,12 +636,12 @@ explainPlotSPC(sp4, name = 'name', n = length(sp4) + 2)
636
636
### Small SoilProfileCollections
637
637
638
638
Making quality figures with fewer than 5 soil profiles usually requires more customization of the basic call to `plotSPC`. In general, the following are a good starting point:
639
-
640
-
* shrink margins and disable clipping with `par`
641
-
* adjust output graphic device (e.g. `png()`) dimensions and resolution
642
-
* increase font size with `cex.names`
643
-
* adjust sketch width with `width`, typically within 0.15-0.35
644
-
* move depth axis to the left using negative `line` values, e.g. (`depth.axis = list(line = -2)`)
639
+
640
+
* shrink margins and disable clipping with `par`
641
+
* adjust output graphic device (e.g. `png()`) dimensions and resolution
642
+
* increase font size with `cex.names`
643
+
* adjust sketch width with `width`, typically within 0.15-0.35
644
+
* move depth axis to the left using negative `line` values, e.g. (`depth.axis = list(line = -2)`)
645
645
646
646
Get some example data from the Official Series Descriptions:
647
647
```{r, fig.width=5, fig.height=6}
@@ -1087,9 +1087,9 @@ The `slab()` function is the simplest way to implement a change of depth support
1087
1087
1088
1088
The depth structure ("slabs") over which summaries are computed is defined with the `slab.structure` argument using:
1089
1089
1090
-
* a single integer (e.g. `10`): data are aggregated over a regular sequence of 10-unit thickness slabs
1091
-
* a vector of 2 integers (e.g. `c(50, 60)`): data are aggregated over depths spanning 50--60 units
1092
-
* a vector of 3 or more integers (e.g. `c(0, 5, 10, 50, 100)`): data are aggregated over the depths spanning 0--5, 5--10, 10--50, 50--100 units
1090
+
* a single integer (e.g. `10`): data are aggregated over a regular sequence of 10-unit thickness slabs
1091
+
* a vector of 2 integers (e.g. `c(50, 60)`): data are aggregated over depths spanning 50--60 units
1092
+
* a vector of 3 or more integers (e.g. `c(0, 5, 10, 50, 100)`): data are aggregated over the depths spanning 0--5, 5--10, 10--50, 50--100 units
1093
1093
1094
1094
```{r slab, fig.height=4, fig.width=8}
1095
1095
# aggregate a couple of the horizon-level attributes,
@@ -1279,17 +1279,9 @@ Calculation of between-profile dissimilarity is performed using `NCSP()` (Numeri
1279
1279
1280
1280
See the [function manual page](http://ncss-tech.github.io/aqp/reference/NCSP.html) and [this paper](http://dx.doi.org/10.1016/j.cageo.2012.10.020) for details.
0 commit comments