| agg {SparkR} | R Documentation |
Aggregates on the entire DataFrame without groups. The resulting DataFrame 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 DataFrame
Other agg_funcs: approxCountDistinct,
approxCountDistinct,
approxCountDistinct; avg,
avg; countDistinct,
countDistinct, n_distinct,
n_distinct; count,
n, n; first,
first; kurtosis,
kurtosis; last,
last; max;
mean; min; sd,
sd, stddev,
stddev; skewness,
skewness; stddev_pop,
stddev_pop; stddev_samp,
stddev_samp; sumDistinct,
sumDistinct; sum;
var_pop, var_pop;
var_samp, var_samp;
var, var,
variance, variance
## 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)