I'm trying to use a list that containing all columns of Spark DataFrame with function last() and put that list in summarize() of grouped DF.
The list is created in this way :
exprs <- lapply(columns(WORK02), function(x) last(x) %>% alias(x))
And then i trying to make somthing like this :
WORK03 <- WORK02 %>%
groupBy(column("AGENZIA")) %>%
summarize(exprs)
I get the following error :
Error in agg(x, ...) : agg can only support Column or character
If i use per example only one element of that list, it works:
WORK03 <- WORK02 %>%
groupBy(column("AGENZIA")) %>%
summarize(exprs[[1]])
Output :
AGENZIA SERV
1 3
But the result that i expect to receive is :
AGENZIA SERV COLUMN_1 COLUMN_2 COLUMN_3 .. COLUMN_N
1 3 V1 V2 V3 VN
Existing an way to do that ?
P.S. Problem is that i can use a limited package of library , only SparkR...