collect {SparkR}R Documentation

Collects all the elements of a Spark DataFrame and coerces them into an R data.frame.

Description

Collects all the elements of a Spark DataFrame and coerces them into an R data.frame.

Usage

## S4 method for signature 'DataFrame'
collect(x, stringsAsFactors = FALSE)

Arguments

x

A SparkSQL DataFrame

stringsAsFactors

(Optional) A logical indicating whether or not string columns should be converted to factors. FALSE by default.

Examples

## Not run: 
##D sc <- sparkR.init()
##D sqlContext <- sparkRSQL.init(sc)
##D path <- "path/to/file.json"
##D df <- jsonFile(sqlContext, path)
##D collected <- collect(df)
##D firstName <- collected[[1]]$name
## End(Not run)

[Package SparkR version 1.5.0 Index]