structType {SparkR} | R Documentation |
Create a structType object that contains the metadata for a SparkDataFrame. Intended for use with createDataFrame and toDF.
structType(x, ...)
## S3 method for class 'jobj'
structType(x, ...)
## S3 method for class 'structField'
structType(x, ...)
## S3 method for class 'character'
structType(x, ...)
x |
a structField object (created with the |
... |
additional structField objects |
a structType object
structType since 1.4.0
## Not run:
##D schema <- structType(structField("a", "integer"), structField("c", "string"),
##D structField("avg", "double"))
##D df1 <- gapply(df, list("a", "c"),
##D function(key, x) { y <- data.frame(key, mean(x$b), stringsAsFactors = FALSE) },
##D schema)
##D schema <- structType("a INT, c STRING, avg DOUBLE")
##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)