collect {SparkR} | R Documentation |
Collects all the elements of a Spark DataFrame and coerces them into an R data.frame.
## S4 method for signature 'DataFrame' collect(x, stringsAsFactors = FALSE)
x |
A SparkSQL DataFrame |
stringsAsFactors |
(Optional) A logical indicating whether or not string columns should be converted to factors. FALSE by default. |
## 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)