This is a very basic introduction to the SoilProfileCollection
class object defined in the aqp
package for R. The SoilProfileCollection
class was designed to simplify the process of working with the collection of data associated with soil profiles: site-level data, horizon-level data, spatial data, diagnostic horizon data, metadata, etc. Examples listed below are meant to be copied/pasted from this document and interactively run within R. Comments (green text) briefly describe what the code in each line does. This document assumes a basic level of proficiency with R which can be gained by reviewing some of the material in tutorials like this. Further documentation on objects and functions from the aqp
package can be accessed by typing help(aqp)
(or more generally, ?function_name
) at the R console.
SoilProfileCollection
objects are typically created by “promoting” data.frame
objects (rectangular tables of data) that contain at least three essential columns:
The data.frame
should be pre-sorted according to the profile ID and horizon top boundary. Formula notation is used to define the columns used to promote a data.frame
object:
idcolumn ~ hz_top_column + hz_bottom_column
In this tutorial we will use some sample data included with the aqp
package, based on characterization data from 10 soils sampled on serpentinitic parent material as described in McGahan et al, 2009.
# load required packages, you may have to install these if missing:
# install.packages('aqp', dep = TRUE)
# remotes::install_github("ncss-tech/aqp", dependencies=FALSE, upgrade=FALSE, build=FALSE)
library(aqp)
library(Hmisc)
library(lattice)
library(MASS)
# lo