| Line 11... |
Line 11... |
| 11 |
% \alias{$.data.frame}
|
11 |
% \alias{$.data.frame}
|
| 12 |
\alias{$<-.data.frame}
|
12 |
\alias{$<-.data.frame}
|
| 13 |
\title{Extract or Replace Parts of a Data Frame}
|
13 |
\title{Extract or Replace Parts of a Data Frame}
|
| 14 |
\description{
|
14 |
\description{
|
| 15 |
Extract or replace subsets of data frames (to replace subsets is also
|
15 |
Extract or replace subsets of data frames (to replace subsets is also
|
| 16 |
called \sQuote{to subassign}).
|
16 |
called \sQuote{to \I{subassign}}).
|
| 17 |
}
|
17 |
}
|
| 18 |
\usage{
|
18 |
\usage{
|
| 19 |
\method{[}{data.frame}(x, i, j, drop = )
|
19 |
\method{[}{data.frame}(x, i, j, drop = )
|
| 20 |
\method{[}{data.frame}(x, i, j) <- value
|
20 |
\method{[}{data.frame}(x, i, j) <- value
|
| 21 |
\method{[[}{data.frame}(x, ..., exact = TRUE)
|
21 |
\method{[[}{data.frame}(x, ..., exact = TRUE)
|
| Line 103... |
Line 103... |
| 103 |
names. By default neither partially match column names, but \code{[[}
|
103 |
names. By default neither partially match column names, but \code{[[}
|
| 104 |
will if \code{exact = FALSE} (and with a warning if \code{exact =
|
104 |
will if \code{exact = FALSE} (and with a warning if \code{exact =
|
| 105 |
NA}). If you want to exact matching on row names use
|
105 |
NA}). If you want to exact matching on row names use
|
| 106 |
\code{\link{match}}, as in the examples.
|
106 |
\code{\link{match}}, as in the examples.
|
| 107 |
|
107 |
|
| 108 |
When the replacement methods are used to subassign into a column vector,
|
108 |
When the replacement methods are used to \I{subassign} into a column vector,
|
| 109 |
the vector elements assigned into must correspond to existing rows in the
|
109 |
the vector elements assigned into must correspond to existing rows in the
|
| 110 |
data frame. If subassignment is used to add a non-existing column, the
|
110 |
data frame. If \I{subassignment} is used to add a non-existing column, the
|
| 111 |
column will be added as described above, with unassigned elements set
|
111 |
column will be added as described above, with unassigned elements set
|
| 112 |
to \code{NA}, see \manual{R-lang}{Subset assignment} for a rationale.
|
112 |
to \code{NA}, see \manual{R-lang}{Subset assignment} for a rationale.
|
| 113 |
}
|
113 |
}
|
| 114 |
\section{Coercion}{
|
114 |
\section{Coercion}{
|
| 115 |
The story over when replacement values are coerced is a complicated
|
115 |
The story over when replacement values are coerced is a complicated
|