flatMapValues {SparkR}R Documentation

Pass each value in the key-value pair RDD through a flatMap function without changing the keys; this also retains the original RDD's partitioning.

Description

The same as 'flatMapValues()' in Spark.

Usage

flatMapValues(X, FUN)

## S4 method for signature 'RDD,'function''
flatMapValues(X, FUN)

Arguments

X

The RDD to apply the transformation.

FUN

the transformation to apply on the value of each element.

Value

a new RDD created by the transformation.

Examples

## Not run: 
##D sc <- sparkR.init()
##D rdd <- parallelize(sc, list(list(1, c(1,2)), list(2, c(3,4))))
##D collect(flatMapValues(rdd, function(x) { x }))
##D Output: list(list(1,1), list(1,2), list(2,3), list(2,4))
## End(Not run)

[Package SparkR version 0.1 Index]