filter {SparkR}R Documentation

Filter

Description

Filter the rows of a DataFrame according to a given condition.

Usage

## S4 method for signature 'DataFrame,characterOrColumn'
filter(x, condition)

## S4 method for signature 'DataFrame,characterOrColumn'
where(x, condition)

filter(x, condition)

where(x, condition)

Arguments

x

A DataFrame to be sorted.

condition

The condition to filter on. This may either be a Column expression or a string containing a SQL statement

Value

A DataFrame containing only the rows that meet the condition.

See Also

Other subsetting functions: $, $<-, select, select, select,DataFrame,Column-method, select,DataFrame,list-method, selectExpr; [, [, [, [[, subset

Examples

## Not run: 
##D sc <- sparkR.init()
##D sqlContext <- sparkRSQL.init(sc)
##D path <- "path/to/file.json"
##D df <- jsonFile(sqlContext, path)
##D filter(df, "col1 > 0")
##D filter(df, df$col2 != "abcdefg")
## End(Not run)

[Package SparkR version 1.5.1 Index]