foreach {SparkR}R Documentation

Applies a function to all elements in an RDD, and force evaluation.

Description

Applies a function to all elements in an RDD, and force evaluation.

Applies a function to each partition in an RDD, and force evaluation.

Usage

foreach(rdd, func)

## S4 method for signature 'RDD,'function''
foreach(rdd, func)

foreachPartition(rdd, func)

## S4 method for signature 'RDD,'function''
foreachPartition(rdd, func)

Arguments

rdd

The RDD to apply the function

func

The function to be applied.

Value

invisible NULL.

Examples

## Not run: 
##D sc <- sparkR.init()
##D rdd <- parallelize(sc, 1:10)
##D foreach(rdd, function(x) { save(x, file=...) })
## End(Not run)
## Not run: 
##D sc <- sparkR.init()
##D rdd <- parallelize(sc, 1:10)
##D foreachPartition(rdd, function(part) { save(part, file=...); NULL })
## End(Not run)

[Package SparkR version 0.1 Index]