Description Usage Arguments Details Value Examples
Extract subset of columns and/or rows of a ml.data.frame. When extracting rows a ml.col.def referense can be used or a search text, see ml.data.frame for query string grammar. See details for limitations when using a reference. The row filtering will be used togheter with the existing query of the ml.data.frame
1 2 |
x |
a ml.data.frame from which to extract element(s). |
i, j |
Indices specifying elements to extract. Indices are 'numeric' or 'character' vectors or empty (missing) or 'NULL'. |
... |
Not used. |
drop |
Not used. |
When extracting rows using ml.col.def comparison operators can be used. For the ">" "<" "!=" "<=" ">=" operators there muset exist a element range index on the source field or a error will be raised, element range index can be created using the ml.add.index function. "==" operator will always work since it does not depend of range indexes.
A ml.data.frame object is returned
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
library(rfml)
localConn <- ml.connect()
# create a ml.data.frame based on the iris data set
mlIris <- as.ml.data.frame(localConn, iris, "iris")
# select first three columns
mlIris2 <- mlIris[1:3]
# same
mlIris2 <- mlIris[,1:3]
# same
mlIris2 <- mlIris[,c("Sepal.Length","Sepal.Width","Petal.Length")]
# select first three columns for all rows with Spieces = setosa
mlIris2 <- mlIris[mlIris$Species=="setosa", 1:3]
# select all columns for all rows with Spieces = setosa
mlIris2 <- mlIris[mlIris$Species=="setosa",]
# select all columns for all rows with "setosa" in any column
mlIris2 <- mlIris["setosa",]
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.