arrange,DataFrame,characterOrColumn-method {SparkR}R Documentation

Arrange

Description

Sort a DataFrame by the specified column(s).

Usage

## S4 method for signature 'DataFrame,characterOrColumn'
arrange(x, col, ...)

## S4 method for signature 'DataFrame,characterOrColumn'
orderBy(x, col)

arrange(x, col, ...)

orderBy(x, col)

Arguments

x

A DataFrame to be sorted.

col

Either a Column object or character vector indicating the field to sort on

...

Additional sorting fields

Value

A DataFrame where all elements are sorted.

Examples

## Not run: 
##D sc <- sparkR.init()
##D sqlContext <- sparkRSQL.init(sc)
##D path <- "path/to/file.json"
##D df <- jsonFile(sqlContext, path)
##D arrange(df, df$col1)
##D arrange(df, "col1")
##D arrange(df, asc(df$col1), desc(abs(df$col2)))
## End(Not run)

[Package SparkR version 1.4.1 Index]