I need to find the mean of a variable and the number of times a particular combination occurs for that mean value in r.
In the example I have grouped by variables cli
, cus
and ron
and need to summarize to find the mean of age
and frequency of cash
for this combination:
df%>% group_by(.dots=c("cli","cus","ron")) %>% summarise_all(mean(age),length(cash))
This doesn't work; is there another way out?