-5

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?

M--
  • 25,431
  • 8
  • 61
  • 93
Murali
  • 1
  • 1
  • Welcome to StackOverflow! Please read the info about [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and [how to give a reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610). This will make it much easier for others to help you – Hardik Gupta Oct 15 '17 at 18:49
  • That's not how `summarise_all` works. – M-- Oct 15 '17 at 18:52

1 Answers1

0

may be it is just me as I seemed to have just over complicated this one, just summarise gets me what I needed df%>% group_by(.dots=c("cli","cus","ron")) %>% summarise(mean(age),length(cash))

Murali
  • 1
  • 1