% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/SoilProfileCollection-methods.R
\name{subsetHz,SoilProfileCollection-method}
\alias{subsetHz,SoilProfileCollection-method}
\alias{subsetHz}
\title{Subset the horizons in a SoilProfileCollection using logical criteria}
\usage{
\S4method{subsetHz}{SoilProfileCollection}(x, ..., drop = TRUE)
}
\arguments{
\item{x}{a SoilProfileCollection}

\item{...}{Comma-separated set of R expressions that evaluate as \code{TRUE} or \code{FALSE} in context of horizon data frame. Length for individual expressions matches number of horizons, in \code{x}.}

\item{drop}{Default: \code{TRUE}. When \code{drop=FALSE} placeholder horizons (profile ID with all other values \code{NA}) are created where the specified filter results in removal of all horizons.}
}
\value{
a SoilProfileCollection with a subset of horizons, possibly with some sites removed
}
\description{
\code{subsetHz()} is a function used for extracting horizons from a SoilProfileCollection based on logical criteria.
}
\details{
To minimize likelihood of issues with non-standard evaluation context, especially when using \code{subsetHz()} inside another function, all expressions used in \code{...} should be in terms of variables that are in the horizon data frame.
}
\examples{

data(sp3)

depths(sp3) <- id ~ top + bottom

# show just horizons with 10YR hues
plot(subsetHz(sp3, hue == '10YR'))

}
