subsetProfiles-methods: Subset SoilProfileCollection Objects.

Description Details Value Methods See Also Examples

Description

This function is used to subset SoilProfileCollection objects using either site-level or horizon-level attributes, or both.

Details

The s argument supplies a fully-quoted search critera for matching via site-level attributes. The h argument supplies a fully-quoted search criteria for matching via horizon-level attributes. All horizons associated with a single horizon-level match (i.e. out of several, only a single horizon matches the search critera) are returned. See examples for usage.

Value

A SoilProfileCollection class object.

Methods

signature(object = "SoilProfileCollection", s = 'character', h = 'character', ...)

See Also

profileApply, site, horizons

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
data(sp1)
depths(sp1) <- id ~ top + bottom
site(sp1) <- ~ group

# save par settings, and setup plot for 3 columns
op <- par(mar=c(1,1,8,1), mfcol=c(1,3))

# subset sp1 via site-level attributes
# note quoting style
plot(group.1 <- subsetProfiles(sp1, s="group == '1'"))

# subset sp1 via horizon-level attributes
# note quoting style
plot(coarse.soils <- subsetProfiles(sp1, h="texture == 'LS'"))

# re-combine subsets, note that duplicates are removed
g <- rbind(group.1, coarse.soils)
plot(g)

# reset plot area
par(op)


# subset sp1 via horizon and site-level attributes
plot(tiny.set <- subsetProfiles(sp1, s="group == 2", h='prop < 8'))


## other ways to subset SoilProfileCollection objects, via index
# more interesting sample data
data(sp2)
depths(sp2) <- id ~ top + bottom
site(sp2) <- ~ surface

# subset by integer index, note that this does not re-order the profiles
plot(sp2[1:5, ])

# generate an integer index via pattern-matching
idx <- grep('modesto', sp2$surface, ignore.case=TRUE)
plot(sp2[idx, ])

# generate in index via profileApply:
# subset those profiles where: min(ph) < 5.6
idx <- which(profileApply(sp2, function(i) min(i$field_ph, na.rm=TRUE) < 5.6))
plot(sp2[idx, ])

Example output

This is aqp 1.10
guessing horizon designations are stored in `name`
guessing horizon designations are stored in `name`
guessing horizon designations are stored in `name`
guessing horizon designations are stored in `name`
guessing horizon designations are stored in `name`
guessing horizon designations are stored in `name`
guessing horizon designations are stored in `name`

aqp documentation built on May 2, 2019, 4:51 p.m.