\Header{Extract}{Extract or Replace Parts of an Object}
\alias{Subscript}{Extract}
\alias{[}{Extract}
\alias{[[}{Extract}
\alias{\$}{Extract}
\alias{[$\leftarrow $}{Extract}
\alias{[[$\leftarrow $}{Extract}
\alias{\$$\leftarrow $}{Extract}
\alias{[.data.frame}{Extract}
\alias{[[.data.frame}{Extract}
\alias{[$\leftarrow $.data.frame}{Extract}
\alias{[[$\leftarrow $.data.frame}{Extract}
\alias{[.factor}{Extract}
\alias{[.formula}{Extract}
\alias{[.ts}{Extract}
\alias{[$\leftarrow $.factor}{Extract}
\keyword{array}{Extract}
\keyword{list}{Extract}
\begin{Usage}
\begin{verbatim}
x[i]
x[i, j, ...]
x[i, j, ... , drop=TRUE]
x[[i]]
x[[i, j, ...]]
x$name
\end{verbatim}
\end{Usage}
\begin{Description}
These operators act on vectors, arrays, dataframes and lists.
If one of these expressions appears on the left side of an assignment
then that part of \texttt{x} is set to the value of the right hand side
of the assignment.

These operators are generic. You can write methods to handle subsetting
of specific classes of data.

The \texttt{[[} operator requires all relevant subscripts be supplied.
With  the \texttt{[} operator a comma separated blank indicates that all
entries in that dimension are selected.

When operating on a list, the \texttt{[[} operator gives the specified
element of the list while the \texttt{[} operator returns a list with
the specified element(s) in it.\end{Description}
\begin{SeeAlso}
\texttt{\Link{list}}, \texttt{\Link{array}}, \texttt{\Link{matrix}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- 1:12; m <- matrix(1:6,nr=2); li <- list(pi=pi, e = exp(1))
x[10]                 # the tenth element of x
m[1,]                 # the first row of matrix m
m[1, , drop = FALSE]  # is a 1-row matrix
li[[1]]               # the first element of list li
y <- list(1,2,a=4,5)
y[c(3,4)]             # a list containing elements 3 and 4 of y
y$a                   # the element of y named a
\end{ExampleCode}
\end{Examples}

