sortByKey {SparkR} | R Documentation |
Sort a (k, v) pair RDD by k.
sortByKey(rdd, ascending, numPartitions) ## S4 method for signature 'RDD,missingOrLogical,missingOrInteger' sortByKey(rdd, ascending, numPartitions)
rdd |
A (k, v) pair RDD to be sorted. |
ascending |
A flag to indicate whether the sorting is ascending or descending. |
numPartitions |
Number of partitions to create. |
An RDD where all (k, v) pair elements are sorted.
## Not run:
##D sc <- sparkR.init()
##D rdd <- parallelize(sc, list(list(3, 1), list(2, 2), list(1, 3)))
##D collect(sortByKey(rdd)) # list (list(1, 3), list(2, 2), list(3, 1))
## End(Not run)