Let's say I have the following dataset where I asked people to tell me what their staff role was and they were able to select multiple questions.
How can I tell R to calculate the mean score for the string 'Teaching'?
> df = data.frame(Staff=c('Teaching','Research','Research,Teaching','Administration', 'Faculty Management', 'Administration, Faculty Management'), score=c('2','1','3','2','1', '2'), length=c(10, 20, 30, 5, 10, 6))
> View(df)
> df
Staff score length
1 Teaching 2 10
2 Research 1 20
3 Research,Teaching 3 30
4 Administration 2 5
5 Faculty Management 1 10
6 Administration, Faculty Management 2 6