createDataFrame {SparkR}R Documentation

Create a DataFrame from an RDD

Description

Converts an RDD to a DataFrame by infer the types.

Usage

createDataFrame(sqlContext, data, schema = NULL, samplingRatio = 1)

Arguments

sqlContext

A SQLContext

data

An RDD or list or data.frame

schema

a list of column names or named list (StructType), optional

Value

an DataFrame

Examples

## Not run: 
##D sc <- sparkR.init()
##D sqlContext <- sparkRSQL.init(sc)
##D rdd <- lapply(parallelize(sc, 1:10), function(x) list(a=x, b=as.character(x)))
##D df <- createDataFrame(sqlContext, rdd)
## End(Not run)

[Package SparkR version 1.5.1 Index]