The solution I found is the following :
For create list of columns what i am trying to select i used function lapply()
exprs <- lapply(columns(WORK02), function(x) last(x) %>% alias(x))
After that, i removed all null values from the list, (this option is in case if someone want to don't select a specific column, otherwise column will be created as NULL , that will give to us an error after).
exprs <- exprs[!sapply(exprs,is.null)]
And finally i performing groupBy() + summarize() with function do.call() in the following mode:
WORK_TEST1 <- WORK02 %>%
groupBy(column("AGENZIA"))
WORK03 <- do.call(summarize,c(WORK_TEST1,exprs))
With this iteration, i receive the result that i'm expecting:
AGENZIA SERV COLUMN_1 COLUMN_2 COLUMN_3 .. COLUMN_N
1 3 V1 V2 V3 VN
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…