structField {SparkR}R Documentation

structField

Description

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

Usage

structField(x, ...)

## S3 method for class 'jobj'
structField(x, ...)

## S3 method for class 'character'
structField(x, type, nullable = TRUE, ...)

Arguments

x

the name of the field.

...

additional argument(s) passed to the method.

type

The data type of the field

nullable

A logical vector indicating whether or not the field is nullable

Value

A structField object.

Note

structField since 1.4.0

Examples

## Not run: 
##D field1 <- structField("a", "integer")
##D field2 <- structField("c", "string")
##D field3 <- structField("avg", "double")
##D schema <-  structType(field1, field2, field3)
##D df1 <- gapply(df, list("a", "c"),
##D               function(key, x) { y <- data.frame(key, mean(x$b), stringsAsFactors = FALSE) },
##D               schema)
## End(Not run)

[Package SparkR version 2.1.1 Index]