top {SparkR}R Documentation

Returns the top N elements from an RDD.

Description

Returns the top N elements from an RDD.

Usage

top(rdd, num)

## S4 method for signature 'RDD,integer'
top(rdd, num)

Arguments

rdd

An RDD.

num

Number of elements to return.

Value

The top N elements from the RDD.

Examples

## 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)

[Package SparkR version 0.1 Index]