sub-ml.data.frame-method: Extract subsets of a ml.data.frame

Description Usage Arguments Details Value Examples

Description

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

Usage

1
2
## S4 method for signature 'ml.data.frame'
x[i, j, ..., drop = TRUE]

Arguments

x

a ml.data.frame from which to extract element(s).

i

hmmmm

j

Integer vector,

...

can be used to specify a groupBy field. Is only used when j is a aggregation.

drop

not used.

Details

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.

Value

A ml.data.frame-class object is returned

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## 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[Species=="setosa", 1:3]
 # select all columns for all rows with Spieces = setosa
 mlIris2 <- mlIris[Species=="setosa",]
 # select all columns for all rows with "setosa" in any column
 mlIris2 <- mlIris["setosa",]
 # get max value for Sepal.Length
 mlIris2 <- mlIris[,max(Sepal.Length)]
 # get max value for Sepal.Length where Spieces = setosa
 mlIris2 <- mlIris[Species=="setosa",,max(Sepal.Length)]
 # get max, min and mean value for Sepal.Length
 mlIris2 <- mlIris[,c(max(Sepal.Length), min(Sepal.Length), mean(Sepal.Length))]

## End(Not run)

mstellwa/rfml documentation built on May 23, 2019, 8:16 a.m.