site: Retrieve site data from SoilProfileCollection

Description Usage Arguments Examples

Description

Get site data from SoilProfileCollection. Result is returned in the same data.frame class used to initially construct the SoilProfileCollection.

There are two options available via the site<- setter.

The first is a "normalization" by formula interface, whereby one specifies an attribute that is constant in horizons within profiles to be promoted to a site-level variable: site(spc) <- ~ horizonvariable

The second is creation of site data from an external data.frame via merge (LEFT JOIN). There must be one or more same-named columns (with at least some matching data) on the left and right hand side to facilitate the join: site(spc) <- newdata

Usage

1
2
3
4
## S4 method for signature 'SoilProfileCollection'
site(object)

site(object) <- value

Arguments

object

A SoilProfileCollection

value

A formula or object inheriting data.frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# load test data
data(sp2)

# promote to SPC
depths(sp2) <- id ~ top + bottom

# normalize a horizon-level attribute to site
site(sp2) <- ~ surface

# inspect site table
site(sp2)

# make some data: classify two geomorphic surfaces with numeric value
newdata <- data.frame(surface = c("holocene",
                                  "lower riverbank"),
                      newvalue = c(1,2))

# do left join based on newly-normalized "surface" attribute
site(sp2) <- newdata

# inspect site table: holocene & lower riverbank have values
site(sp2)

aqp documentation built on Aug. 20, 2021, 1:12 a.m.