mapValues {SparkR}R Documentation

Applies a function to all values of the elements, without modifying the keys.

Description

The same as ‘mapValues()’ in Spark.

Usage

mapValues(X, FUN)

## S4 method for signature 'RDD,'function''
mapValues(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, 1:10)
##D makePairs <- lapply(rdd, function(x) { list(x, x) })
##D collect(mapValues(makePairs, function(x) { x * 2) })
##D Output: list(list(1,2), list(2,4), list(3,6), ...)
## End(Not run)

[Package SparkR version 0.1 Index]