Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205372

More efficient way to perform calculations on multiple (combined) columns by group

$
0
0

What is a more efficient way to perform calculations on multiple combined columns by group?

I have a dataset with Manager Effectiveness & Team Effectiveness components. How can I quickly calculate the number of 5s for each component by gender?

So far, I've tried the dplyr method:

Data %>% group_by(gender) %>% summarise(sum(c(Manager EQ, Manager IQ)) == 5)

Data %>% group_by(gender) %>% summarise(sum(c(Team collaboration, Team friendliness)) == 5)

Though it works, typing each column name quickly becomes tedious and error-prone as more columns are involved.


Viewing all articles
Browse latest Browse all 205372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>