% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/extract-methods.R
\docType{methods}
\name{[,otu_table,ANY,ANY,ANY-method}
\alias{[,otu_table,ANY,ANY,ANY-method}
\alias{[,sample_data,ANY,ANY,ANY-method}
\alias{[,taxonomyTable,ANY,ANY,ANY-method}
\alias{[,XStringSet,character,ANY,ANY-method}
\title{Method extensions to extraction operator for phyloseq objects.}
\usage{
\S4method{[}{otu_table,ANY,ANY,ANY}(x, i, j, ..., drop = TRUE)

\S4method{[}{sample_data,ANY,ANY,ANY}(x, i, j, ..., drop = TRUE)

\S4method{[}{taxonomyTable,ANY,ANY,ANY}(x, i, j, ..., drop = TRUE)

\S4method{[}{XStringSet,character,ANY,ANY}(x, i)
}
\arguments{
\item{x}{
    object from which to extract element(s) or in which to replace element(s).
  }

\item{i}{
    indices specifying elements to extract or replace.  Indices are
    \code{numeric} or \code{character} vectors or empty (missing) or
    \code{NULL}.  Numeric values are coerced to integer as by
    \code{\link{as.integer}} (and hence truncated towards zero).
    Character vectors will be matched to the \code{\link{names}} of the
    object (or for matrices/arrays, the \code{\link{dimnames}}):
    see \sQuote{Character indices} below for further details.

    For \code{[}-indexing only: \code{i}, \code{j}, \code{\dots} can be
    logical vectors, indicating elements/slices to select.  Such vectors
    are recycled if necessary to match the corresponding extent.
    \code{i}, \code{j}, \code{\dots} can also be negative integers,
    indicating elements/slices to leave out of the selection.

    When indexing arrays by \code{[} a single argument \code{i} can be a
    matrix with as many columns as there are dimensions of \code{x}; the
    result is then a vector with elements corresponding to the sets of
    indices in each row of \code{i}.

    An index value of \code{NULL} is treated as if it were \code{integer(0)}.
  }

\item{j}{See \code{\link[base]{Extract}}}

\item{...}{See \code{\link[base]{Extract}}}

\item{drop}{For matrices and arrays.  If \code{TRUE} the result is
    coerced to the lowest possible dimension (see the examples).  This
    only works for extracting elements, not for the replacement.  See
    \code{\link{drop}} for further details.
  }
}
\description{
See the documentation for the \code{\link[base]{Extract}} generic,
defined in the R \code{\link[base]{base-package}}
for the expected behavior.
}
\details{
One special exception to standard behavior of these methods in phyloseq is that
the \code{drop} argument is set internally to \code{FALSE}.
This helps avoid bugs during complicated subsetting with multiple components,
where it is necessary to be able to use a two dimensional indexing even
if one of those dimensions has only 1 rank. 
Put another way, these phyloseq-defined extractions never collapse their result
into a vector. See the documentation of \code{\link[base]{Extract}} for
more information about the \code{drop} argument.
}
\examples{
data(esophagus)
nrow(otu_table(esophagus))
nrow(otu_table(esophagus)[1:5, ])
}
\seealso{
\code{\link[base]{Extract}}
}
