Learn R Programming

aqp (version 1.27)

subset,SoilProfileCollection-method: Subset a SoilProfileCollection with logical expressions

Description

subset() is a function used for subsetting SoilProfileCollections. It allows the user to specify an arbitrary number of logical vectors (equal in length to site or horizon), separated by commas. The function includes some support for non-standard evaluation found in the tidyverse. This greatly simplifies access to site and horizon-level variable compared to subset.default, as `$` or `[[` methods are not needed.

Usage

# S4 method for SoilProfileCollection
subset(x, ..., greedy = FALSE)

# S4 method for SoilProfileCollection filter(.data, ..., .preserve = FALSE)

Arguments

x

A SoilProfileCollection

...

Comma-separated set of R expressions that evaluate as TRUE or FALSE. Length for individual expressions matches number of sites OR number of horizons, in object.

greedy

Use "greedy" matching for combination of site and horizon level matches? greedy = TRUE is the union, whereas greedy = FALSE (default) is the intersection (of site and horizon matches).

.data

A SoilProfileCollection (filter method only, in lieu of x)

.preserve

Relevant when the .data input is grouped. Not (yet) implemented for SoilProfileCollection objects.

Value

A SoilProfileCollection.

Details

In base R, the method that performs extraction based on a set of expressions is subset, so this is the "default" name in the AQP package. The filter method is defined in the base R stats package for linear filtering of time series. If you need to use the base method after loading aqp, you can use stats::filter to be explicit about which function you want. We mirror the dplyr package in over-loading the filter method with a generic that allows for arbitrary number of vectors (...) to be included in the "filter," which means you may also need to use aqp::filter or dplyr::filter as appropriate depending on the order you load packages or your conflict resolution option settings.

See Also

filter