I am trying to calculate the median of specific groups using RStudio. I have inputted my data using a .csv file and my data set (MyData2) looks like the following:
score group
1 7 DiseaseX
2 14 DiseaseX
3 6 DiseaseX
4 6 DiseaseX
5 5 DiseaseX
6 5 DiseaseX
7 5 DiseaseX
8 14 DiseaseX
9 9 DiseaseY
10 5 DiseaseY
11 9 DiseaseY
12 7 DiseaseY
13 6 DiseaseY
14 5 DiseaseY
How would I compute the mean 'score' for each Disease X group and the Disease Y group?
I have tried using the group_by function as follows but I keep receiving an error.
MyData2 %>%
group_by(group) %>%
summarize(median = median(MyData2),
sum = sum(MyData2))
Please note that I am a novice RStudio user and am trying to teach myself the basics of this program.