agg {SparkR} | R Documentation |
Count the number of rows for each group. The resulting DataFrame will also contain the grouping columns.
Aggregates on the entire DataFrame without groups. The resulting DataFrame will also contain the grouping columns.
agg(x, ...) summarize(x, ...) ## S4 method for signature 'GroupedData' count(x) ## S4 method for signature 'GroupedData' agg(x, ...) ## S4 method for signature 'GroupedData' summarize(x, ...)
x |
a GroupedData |
x |
a GroupedData |
df2 <- agg(df, <column> = <aggFunction>) df2 <- agg(df, newColName = aggFunction(column))
a DataFrame
a DataFrame
## Not run:
##D count(groupBy(df, "name"))
## End(Not run)
## Not run:
##D df2 <- agg(df, age = "sum") # new column name will be created as 'SUM(age#0)'
##D df2 <- agg(df, ageSum = sum(df$age)) # Creates a new column named ageSum
## End(Not run)