lapply,RDD,function-method {SparkR} | R Documentation |
This function creates a new RDD by applying the given transformation to all elements of the given RDD
## S4 method for signature 'RDD,'function'' lapply(X, FUN) map(X, FUN) ## S4 method for signature 'RDD,'function'' map(X, FUN)
X |
The RDD to apply the transformation. |
FUN |
the transformation to apply on each element |
a new RDD created by the transformation.
## Not run:
##D sc <- sparkR.init()
##D rdd <- parallelize(sc, 1:10)
##D multiplyByTwo <- lapply(rdd, function(x) { x * 2 })
##D collect(multiplyByTwo) # 2,4,6...
## End(Not run)