structField {SparkR}R Documentation

structField

Description

Create a structField object that contains the metadata for a single field in a schema.

Usage

structField(x, ...)

Arguments

x

The name of the field

type

The data type of the field

nullable

A logical vector indicating whether or not the field is nullable

Value

a structField object

Examples

## Not run: 
##D sc <- sparkR.init()
##D sqlCtx <- sparkRSQL.init(sc)
##D rdd <- lapply(parallelize(sc, 1:10), function(x) { list(x, as.character(x)) })
##D field1 <- structField("a", "integer", TRUE)
##D field2 <- structField("b", "string", TRUE)
##D schema <- structType(field1, field2)
##D df <- createDataFrame(sqlCtx, rdd, schema)
## End(Not run)

[Package SparkR version 1.5.1 Index]