collect {SparkR} | R Documentation |
collect
returns a list that contains all of the elements in this RDD.
collectPartition
returns a list that contains all of the elements
in the specified partition of the RDD.
collectAsMap
returns a named list as a map that contains all of the elements
in a key-value pair RDD.
collect(rdd, ...) ## S4 method for signature 'RDD' collect(rdd, flatten = TRUE) collectPartition(rdd, partitionId) ## S4 method for signature 'RDD,integer' collectPartition(rdd, partitionId) collectAsMap(rdd) ## S4 method for signature 'RDD' collectAsMap(rdd)
rdd |
The RDD to collect |
... |
Other optional arguments to collect |
flatten |
FALSE if the list should not flattened |
partitionId |
the partition to collect (starts from 0) |
a list containing elements in the RDD
## Not run:
##D sc <- sparkR.init()
##D rdd <- parallelize(sc, 1:10, 2L)
##D collect(rdd) # list from 1 to 10
##D collectPartition(rdd, 0L) # list from 1 to 5
## End(Not run)
## Not run:
##D sc <- sparkR.init()
##D rdd <- parallelize(sc, list(list(1, 2), list(3, 4)), 2L)
##D collectAsMap(rdd) # list(`1` = 2, `3` = 4)
## End(Not run)