Consider the inbuilt iris dataset in R.
Use the mean() function from the mosaic package.
mean(iris$Sepal.Length~iris$Species)
This command gives the mean values of Sepal-Length across different species of the iris flower.
And, when you run this command, you will see in the output that “virginica” has the highest sepal length and “setosa” has the lowest sepal length.