Description Usage Arguments Value Note Examples
Create a structType object that contains the metadata for a SparkDataFrame. Intended for use with createDataFrame and toDF.
1 2 3 4 5 6 7 8 9 10 | 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
1 2 3 4 5 6 7 8 9 10 11 12 | ## Not run:
schema <- structType(structField("a", "integer"), structField("c", "string"),
structField("avg", "double"))
df1 <- gapply(df, list("a", "c"),
function(key, x) { y <- data.frame(key, mean(x$b), stringsAsFactors = FALSE) },
schema)
schema <- structType("a INT, c STRING, avg DOUBLE")
df1 <- gapply(df, list("a", "c"),
function(key, x) { y <- data.frame(key, mean(x$b), stringsAsFactors = FALSE) },
schema)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.