fold {SparkR} | R Documentation |
Aggregate the elements of each partition, and then the results for all the partitions, using a given associative function and a neutral "zero value".
fold(rdd, zeroValue, op) ## S4 method for signature 'RDD' fold(rdd, zeroValue, op)
rdd |
An RDD. |
zeroValue |
A neutral "zero value". |
op |
An associative function for the folding operation. |
The folding result.
reduce
## Not run:
##D sc <- sparkR.init()
##D rdd <- parallelize(sc, list(1, 2, 3, 4, 5))
##D fold(rdd, 0, "+") # 15
## End(Not run)