| Line 62... |
Line 62... |
| 62 |
The replacement methods can be used to add whole column(s) by specifying
|
62 |
The replacement methods can be used to add whole column(s) by specifying
|
| 63 |
non-existent column(s), in which case the column(s) are added at the
|
63 |
non-existent column(s), in which case the column(s) are added at the
|
| 64 |
right-hand edge of the data frame and numerical indices must be
|
64 |
right-hand edge of the data frame and numerical indices must be
|
| 65 |
contiguous to existing indices. On the other hand, rows can be added
|
65 |
contiguous to existing indices. On the other hand, rows can be added
|
| 66 |
at any row after the current last row, and the columns will be
|
66 |
at any row after the current last row, and the columns will be
|
| 67 |
in-filled with missing values.
|
67 |
in-filled with missing values. Missing values in the indices are not
|
| - |
|
68 |
allowed for replacement.
|
| 68 |
|
69 |
|
| 69 |
For \code{[} the replacement value can be a list: each element of the
|
70 |
For \code{[} the replacement value can be a list: each element of the
|
| 70 |
list is used to replace (part of) one column, recycling the list as
|
71 |
list is used to replace (part of) one column, recycling the list as
|
| 71 |
necessary. If the columns specified by number are created, the names
|
72 |
necessary. If the columns specified by number are created, the names
|
| 72 |
(if any) of the corresponding list elements are used to name the
|
73 |
(if any) of the corresponding list elements are used to name the
|
| Line 75... |
Line 76... |
| 75 |
columns to be deleted.
|
76 |
columns to be deleted.
|
| 76 |
|
77 |
|
| 77 |
Matrixing indexing using \code{[} is not recommended, and barely
|
78 |
Matrixing indexing using \code{[} is not recommended, and barely
|
| 78 |
supported. For extraction, \code{x} is first coerced to a matrix.
|
79 |
supported. For extraction, \code{x} is first coerced to a matrix.
|
| 79 |
For replacement a logical matrix (only) can be used to select the
|
80 |
For replacement a logical matrix (only) can be used to select the
|
| 80 |
elements to be replaced in the same ways as for a matrix.
|
81 |
elements to be replaced in the same ways as for a matrix (except that
|
| 81 |
Missing values in the matrix are treated as false, unlike S which
|
82 |
missing values are not allowed at all).
|
| 82 |
does not replace them but uses up the corresponding values in \code{value}.
|
- |
|
| 83 |
}
|
83 |
}
|
| 84 |
\section{Coercion}{
|
84 |
\section{Coercion}{
|
| 85 |
The story over when replacement values are coerced is a complicated
|
85 |
The story over when replacement values are coerced is a complicated
|
| 86 |
one, and one that has changed during \R's development. This section
|
86 |
one, and one that has changed during \R's development. This section
|
| 87 |
is a guide only.
|
87 |
is a guide only.
|