| agg {SparkR} | R Documentation |
Aggregates on the entire SparkDataFrame without groups. The resulting SparkDataFrame will also contain the grouping columns.
## S4 method for signature 'GroupedData' agg(x, ...) ## S4 method for signature 'GroupedData' summarize(x, ...)
x |
a GroupedData |
df2 <- agg(df, <column> = <aggFunction>) df2 <- agg(df, newColName = aggFunction(column))
a SparkDataFrame
Other agg_funcs: approxCountDistinct,
avg, countDistinct,
first, kurtosis,
last, max,
mean, min, n,
sd, skewness,
stddev_pop, stddev_samp,
sumDistinct, sum,
var_pop, var_samp,
var
## Not run:
##D df2 <- agg(df, age = "sum") # new column name will be created as 'SUM(age#0)'
##D df3 <- agg(df, ageSum = sum(df$age)) # Creates a new column named ageSum
##D df4 <- summarize(df, ageSum = max(df$age))
## End(Not run)