SPC-unique-methods: Get Indices to Unique Soil Profiles Within a Collection

Description Usage Arguments Details Value Methods Author(s) Examples

Description

This function returns a set of indices to a subset of profiles within a SoilProfileCollection object that are uniquely defined by a named set of horizon and site level attributes.

Usage

1
uniqueSPC(x, vars)

Arguments

x

a SoilProfileCollection

vars

a character vector naming those horizon and site level attributes that will be used to test for duplication

Details

Duplicates are identified via MD5 hash of select horizon and site level attributes.

Value

A vector of integer indices that can be used to subset unique profiles from the original SoilProfileCollection object.

Methods

signature(x = "SoilProfileCollection")

Author(s)

D.E. Beaudette

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## use the digest library to detect duplicate data
data(sp1)

# make a copy, make new IDs, and stack
s.1 <- sp1 
s.2 <- sp1
s.2$id <- paste(s.2$id, '-copy', sep='')
s <- rbind(s.1, s.2)
depths(s) <- id ~ top + bottom

# digests are computed from horizon-level data only
# horizon boundaries and 'prop'
# result is an index of unqique profiles

u <- unique(s, vars=c('top', 'bottom', 'prop'))

# compare with and without dupes:
# note subsetting of SoilProfileCollection
cbind(dupes=length(s), no.dupes=length(s[u, ]))

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