top {SparkR} | R Documentation |
Returns the top N elements from an RDD.
top(rdd, num) ## S4 method for signature 'RDD,integer' top(rdd, num)
rdd |
An RDD. |
num |
Number of elements to return. |
The top N elements from the RDD.
## Not run:
##D sc <- sparkR.init()
##D rdd <- parallelize(sc, list(10, 1, 2, 9, 3, 4, 5, 6, 7))
##D top(rdd, 6L) # list(10, 9, 7, 6, 5, 4)
## End(Not run)