Learn R Programming

aqp (version 2.1.0)

depths: 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 SoilProfileCollection
depths(x, hzID = FALSE, ...)

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

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

Value

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

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.

See Also

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

Examples

Run this code
# 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)

Run the code above in your browser using DataLab