Skip to contents

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

Usage

filter(x, condition)

where(x, condition)

# S4 method for class 'SparkDataFrame,characterOrColumn'
filter(x, condition)

# S4 method for class 'SparkDataFrame,characterOrColumn'
where(x, condition)

Arguments

x

A SparkDataFrame 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 SparkDataFrame containing only the rows that meet the condition.

Note

filter since 1.4.0

where since 1.4.0

Examples

if (FALSE) { # \dontrun{
sparkR.session()
path <- "path/to/file.json"
df <- read.json(path)
filter(df, "col1 > 0")
filter(df, df$col2 != "abcdefg")
} # }