Learn R Programming

SparkR (version 2.1.2)

createDataFrame: Create a SparkDataFrame

Description

Converts R data.frame or list into SparkDataFrame.

Usage

# S3 method for default
createDataFrame(data, schema = NULL, samplingRatio = 1,
  numPartitions = NULL)

# S3 method for default as.DataFrame(data, schema = NULL, samplingRatio = 1, numPartitions = NULL)

as.DataFrame(data, ...)

Arguments

data

a list or data.frame.

schema

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

samplingRatio

Currently not used.

numPartitions

the number of partitions of the SparkDataFrame. Defaults to 1, this is limited by length of the list or number of rows of the data.frame

...

additional argument(s).

Value

A SparkDataFrame.

Examples

Run this code
# NOT RUN {
sparkR.session()
df1 <- as.DataFrame(iris)
df2 <- as.DataFrame(list(3,4,5,6))
df3 <- createDataFrame(iris)
df4 <- createDataFrame(cars, numPartitions = 2)
# }

Run the code above in your browser using DataLab