filter: Subset a data source by rows

Description Usage Arguments Value See Also Examples

Description

Subset a data source by rows

Usage

1
2
3
4
5
## S3 method for class 'RxFileData'
filter(.data, ..., .outFile = tbl_xdf(.data), .rxArgs)

## S3 method for class 'RxDataSource'
filter(.data, ...)

Arguments

.data

A data source.

...

Expressions to filter by.

.outFile

Output format for the returned data. If not supplied, create an xdf tbl; if NULL, return a data frame; if a character string naming a file, save an Xdf file at that location.

.rxArgs

A list of RevoScaleR arguments. See rxArgs for details.

Value

An object representing the filtered data. This depends on the .outFile argument: if missing, it will be an xdf tbl object; if NULL, a data frame; and if a filename, an Xdf data source referencing a file saved to that location.

See Also

filter in package dplyr, subset

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
mtx <- as_xdf(mtcars, overwrite=TRUE)
tbl <- filter(mtx, mpg > 20)
nrow(tbl)
tbl2 <- filter(mtx, am == 1, vs == 1)
nrow(tbl2)

# filter on rows and columns simultaneously with .rxArgs
tbl3 <- filter(mtx, am == 1, vs == 1, .rxArgs=list(varsToKeep=c("mpg", "cyl")))
dim(tbl3)

# save to a persistent Xdf file
filter(mtx, am == 1, vs == 1, .outFile="mtcars_filter.xdf")

RevolutionAnalytics/dplyrXdf documentation built on June 3, 2019, 9:08 p.m.