structType {SparkR} | R Documentation |
Create a structType object that contains the metadata for a DataFrame. Intended for use with createDataFrame and toDF.
structType(x, ...)
x |
a structField object (created with the field() function) |
... |
additional structField objects |
a structType object
## Not run: sc <- sparkR.init() sqlCtx <- sparkRSQL.init(sc) rdd <- lapply(parallelize(sc, 1:10), function(x) { list(x, as.character(x)) }) schema <- structType(structField("a", "integer"), structField("b", "string")) df <- createDataFrame(sqlCtx, rdd, schema) ## End(Not run)