[.ggobiDataset {Rggobi} | R Documentation |
These functions/methods allow one to treat
a ggobi dataset as if it were a local matrix/data.frame.
One can extract and assign elements within the
dataset.
There is a fundamental difference between
the two assignment operators ([<-
and [[<-
).
The [<-
operator first retrieves all the data
from the GGobi dataset, does the replacement using R's
semantics and then resets the data.
[[<-
attempts directly replaces
the value(s) specified by the index d
within the GGobi. This is much more efficient
as it avoids copying all the data.
However, the semantics are not the same as the
usual R subsetting. This is currently intended
for changing individual points and support for
vector indices will probably change.
"[.ggobiDataset"(x, ..., drop=F) "[<-.ggobiDataset"(x, i, j, value) "[[<-.ggobiDataset"(x, i, j, value)
x |
the ggobiDataset object |
drop |
the drop argument as in the regular matrix and data frame subsetting functions. This is passed to the relevant subset operation when the data is transferred. |
... |
the indices by which to subset the dataset |
i |
the indices for selecting the rows of the matrix to which the values are to be assigned. |
j |
the indices for selecting the columns of the matrix to which the values are to be assigned. |
value |
the values to assigned to the elements of the matrix. |
At present, the assignment is unecessarily expensive in that it transfers the entire dataset from ggobi, performs the usual subsetting operations and then transfers the results back into the variables of the original dataset. This can be made smarter.
The subsetting operator [
returns the result of subsetting the
matrix corresponding to the ggobi dataset.
This is identical to the functionality of the
subsetting of a matrix.
The assignment operator [<-
returns the original ggobiDataset
object. The side-effect is to modify the
contents of the internal ggobi dataset.
Duncan Temple Lang
setVariableValues.ggobi
getVariable.ggobi
getData.ggobi
names.ggobiDataset
dimnames.ggobiDataset
g <- ggobi(system.file("data", "flea.xml", package="Rggobi"), args="-noinit") d <- g[[1]] d[1,1] <- 100 # d[[1,1]] <- 100 # g$getData()[1,1] d[1:3,1:2] <- .3 d[1:3,1:2]