This is my first time trying to work with grouped data. I have a data set of employees and their managers. I grouped them into teams based on the manager using the group_by function. Now that they are in teams I want to look at their levels of engagement within each team. I'm trying to look at groups that have more people with an engagement rating of 5 than an engagement rating of <=2 and see whether average engagement on teams with more highly engaged people than actively disengaged people is higher than when there are more actively disengaged than engaged people on a team. I've tried to create an ifelse statement and have it check each group and then print in a separate column whether the group would be considered high or low engagement: if (sum(testdat$Engagement Index Mean.x<5 & testdat$Engagement Index Mean.x>2)) { print("Medium")} else {print("Other")} My goal there was going to be to make three statements in three new columns to try and organize them, but obviously I would prefer the information in one column.
I also tried something like this:
full_data$TeamEngagement <-ifelse(sum(teams$Engagement Index Mean.x==5), 'High', ifelse(sum(teams$Engagement Index Mean.x<=2), "Low", ifelse(sum(teams$Engagement Index Mean.x<5 & teams$Engagement Index Mean.x>2), "Medium") ))
But it resulted in a new column of NAs
After I know which teams have more versus fewer highly engaged people I then need to calculate average engagement.
Thanks!
Aucun commentaire:
Enregistrer un commentaire