structField {SparkR} | R Documentation |
Create a structField object that contains the metadata for a single field in a schema.
structField(x, ...)
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 |
a structField object
## Not run: sc <- sparkR.init() sqlCtx <- sparkRSQL.init(sc) rdd <- lapply(parallelize(sc, 1:10), function(x) { list(x, as.character(x)) }) field1 <- structField("a", "integer", TRUE) field2 <- structField("b", "string", TRUE) schema <- structType(field1, field2) df <- createDataFrame(sqlCtx, rdd, schema) ## End(Not run)