SparkR (version 2.1.2)

structType: structType

Description

Create a structType object that contains the metadata for a SparkDataFrame. Intended for use with createDataFrame and toDF.

Usage

structType(x, ...)

# S3 method for jobj structType(x, ...)

# S3 method for structField structType(x, ...)

Arguments

x

a structField object (created with the field() function)

...

additional structField objects

Value

a structType object

Examples

Run this code
# NOT RUN {
schema <-  structType(structField("a", "integer"), structField("c", "string"),
                      structField("avg", "double"))
df1 <- gapply(df, list("a", "c"),
              function(key, x) { y <- data.frame(key, mean(x$b), stringsAsFactors = FALSE) },
              schema)
# }

Run the code above in your browser using DataLab