mapValues {SparkR} | R Documentation |
The same as ‘mapValues()’ in Spark.
mapValues(X, FUN) ## S4 method for signature 'RDD,'function'' mapValues(X, FUN)
X |
The RDD to apply the transformation. |
FUN |
the transformation to apply on the value of each element. |
a new RDD created by the transformation.
## 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)