I have this chunk of code:
trimmedMeans <- cleaned %>%
filter(TrackName == t & ToBeTrimmed != 1) %>%
group_by(TrackName, SpeakerName) %>%
summarise(Expectation.Mean = mean(Expectation, na.rm = TRUE),
Expectation.Sd = sd(Expectation, na.rm = TRUE),
Interesting.Mean = mean(Interesting, na.rm = TRUE),
Interesting.Sd = sd(Interesting, na.rm = TRUE),
Useful.Mean = mean(Useful, na.rm = TRUE),
Useful.Sd = sd(Useful, na.rm = TRUE),
OralPresentation.Mean = mean(OralPresentation, na.rm = TRUE),
OralPresentation.Sd = sd(OralPresentation, na.rm = TRUE),
NumOfVoters = n()
)
Now supposing to have this vector:
myvars <- c("Expectation", "Interesting", "Useful", "OralPresentation")
I'd like to generalize the previous chunk of code using the vector myvars
dynamically.