You should use the commands, as given below:
iris %>% group_by(Species) %>% summarise(mean(Sepal.Length))
iris %>% group_by(Species) %>% summarise(mean(Sepal.Width))
Please note that these are two separate commands. You will require to run these two queries, one by one, to know the desired mean value.
When I run library(ggplot2) and library(dplyr) then only it is identifying %>%.How do we come to know which library is required for which command ?