Learn R Programming

aqp (version 1.25)

glom,SoilProfileCollection-method: Subset soil horizon data using a depth or depth interval

Description

glom() returns a "clod" of horizons from a single profile SoilProfileCollection that have depth (range) in common.

All horizons included within the specified interval are returned in their entirety (not just the portion within the interval), unless the truncate argument is specified. Horizon intersection is based on unique ID hzidname(spc) and attribute of interest.

If intersection at the specified boundaries ['z1', 'z2'] results in no horizon data, 'NULL' is returned with a warning containing the offending pedon ID.

If inverting results with invert, it is possible that thick horizons (that span more than the entire glom interval) will be split into two horizons. This may make the results from ids = TRUE different from what you expect, as they will be based on a profile with an "extra" horizon.

If the upper or lower bound is less than or greater than the shallowest top depth or deepest bottom depth, respectively, a warning is issued, but the horizons within the interval are returned as usual. Users can handle the possibility of incomplete results using evalMissingData or similar approach. While these warnings can make for messy standard output, it is felt by the author that users need to consciously "choose" to ignore (e.g. via suppressWarnings) this output. Most commonly these warning occurs when calling glom on a SPC that is impractical to inspect via glomApply, so it may be the only warning of a potential problem in a downstream analysis.

Usage

# S4 method for SoilProfileCollection
glom(
  p,
  z1,
  z2 = NA,
  ids = FALSE,
  df = FALSE,
  truncate = FALSE,
  invert = FALSE,
  modality = "all"
)

Arguments

p

A single-profile SoilProfileCollection; usually glom is called via profileApply() e.g. via convenience method glomApply

z1

Top depth (required) - depth to intersect horizon; if 'z2' specified, top depth of intersect interval.

z2

OPTIONAL: Bottom depth - bottom depth of intersection interval

ids

Return just horizon IDs in interval? default: FALSE

df

Return a data.frame, by intersection with horizons(p)? default: FALSE

truncate

Truncate horizon top and bottom depths to z1 and z2? default: FALSE

invert

Get the horizons/depth ranges of the profile outside the interval z1/z2? default: FALSE

modality

Return all data (default: "all") or first, thickest (modality = "thickest") horizon in interval. This can be a way of flattening a many:1 relationship over a depth interval applied to a set of profiles.)

Value

A SoilProfileCollection, data.frame, or a vector of horizon IDs. NULL if no result.

Details

The verb/function that creates a clod is "glom". "To glom" is "to steal" or to "become stuck or attached to". The word is related to the compound "glomalin", which is a glycoprotein produced by mycorrhizal fungi in soil.

See Also

glomApply trunc

Examples

Run this code
# NOT RUN {
data(sp1, package = 'aqp')
depths(sp1) <- id ~ top + bottom
site(sp1) <- ~ group

p <- sp1[1]

foo <- glom(p, 25, 100)

# there are 4 horizons in the clod glommed from depths 25 to 100 on profile 1 in sp1
nrow(foo)
# }

Run the code above in your browser using DataLab