Hopefully this will get you most of the way — the problem is that you were using summarise() in an unusual way. You code gets much simpler if you rewrite it to work with multiple arguments, rather than cbind()ing multiple results back together. Let me know if you get stuck anywhere else and I'm happy to take a look.
Hopefully this will get you most of the way — the problem is that you were using
summarise()
in an unusual way. You code gets much simpler if you rewrite it to work with multiple arguments, rather thancbind()
ing multiple results back together. Let me know if you get stuck anywhere else and I'm happy to take a look.