depths: Initialize a SoilProfileCollection from a data.frame object

depths<-,SoilProfileCollection-methodR Documentation

Initialize a SoilProfileCollection from a data.frame object

Description

Initialize a SoilProfileCollection from a data.frame object

Usage

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

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

Arguments

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.

Examples

## 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 April 12, 2022, 1:05 a.m.