JaimeCr JaimeCr - 3 months ago 36
R Question

How to convert SparkR DataFrame to RDD

I know how to convert a text file into an RDD with SparkR:

data <- textFile(sc, "data/tsv_wiki")


But I would want to know how to convert an object of type DataFrame in R to an RDD.

Any help would be appreciated.

Answer

It couldn't be easier.

converted.rdd <- SparkR:::toRDD(dataframe)

Note the triple colon operator, meaning that it's an internal function.

Comments