filterRDD {SparkR}R Documentation

This function returns a new RDD containing only the elements that satisfy a predicate (i.e. returning TRUE in a given logical function). The same as ‘filter()’ in Spark.

Description

This function returns a new RDD containing only the elements that satisfy a predicate (i.e. returning TRUE in a given logical function). The same as ‘filter()’ in Spark.

Usage

filterRDD(x, f)

## S4 method for signature 'RDD,'function''
filterRDD(x, f)

## S4 method for signature ''function',RDD'
Filter(f, x)

Arguments

x

The RDD to be filtered.

f

A unary predicate function.

Examples

## Not run: 
##D sc <- sparkR.init()
##D rdd <- parallelize(sc, 1:10)
##D unlist(collect(filterRDD(rdd, function (x) { x < 3 }))) # c(1, 2)
## End(Not run)

[Package SparkR version 0.1 Index]