depths: Initialize a SoilProfileCollection from data.frame

depthsR Documentation

Initialize a SoilProfileCollection from data.frame

Description

⁠depths(<data.frame>) <- <formula>⁠: Initialize SoilProfileCollection

⁠depths(<SoilProfileCollection>)⁠: Extract profile ID and horizon depths from SoilProfileCollection

Usage

## S4 method for signature 'SoilProfileCollection'
depths(x, hzID = FALSE, ...)

## S4 replacement method for signature 'SoilProfileCollection'
depths(object) <- value

## S4 replacement method for signature 'data.frame'
depths(object) <- value

Arguments

x

A SoilProfileCollection

hzID

Include horizon ID? Usually this is calculated from the (sorted) row index unless ⁠hzidname()<-⁠ has been called. Default: FALSE

...

not used

object

An object to promote to SoilProfileCollection (inherits from data.frame)

value

A formula specifying the unique profile ID, top and bottom depth column names

Details

The input horizon data, and the resulting profile order, is sorted based on unique profile ID and top depth. ID columns are converted to character, depth columns are converted to integer. If NA values exist in all of the top depths, a prototype with 1 horizon per profile ID is returned, with NA in all non-essential columns. If the input object has 0 rows, a prototype with 0 horizons and 0 rows, but same column names as object, is returned.

Value

a data.frame containing profile ID, top depth, and bottom depth

See Also

horizons() idname() hzidname() horizonDepths()

Examples

# load a SoilProfileCollection
data(jacobs2000, package = "aqp")

depths(jacobs2000)
## init SoilProfileCollection objects from data.frame of horizon data

# load demo data
data(sp1)

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

# plot
plot(sp1)

# number of profiles
length(sp1)

# number of horizons
nrow(sp1)


aqp documentation built on Oct. 19, 2024, 5:06 p.m.