Hi, and welcome!
Like R
itself, many of us who answer questions here follow the principle of lazy evaluation
. That why you should see the FAQ: What's a reproducible example (`reprex`) and how do I create one? The most common problem, even when complete code such as you've provided, is a lack of the data object.
There's a variety of ways to handle this:
- dput(your_data) and cut and paste the output
- If large, do the same with a sample
gist
a csv file- Find a built-in data set that has the same structure
In this case, the iris
dataset is parallel.
I'm going to be further lazy and use ggplot2
because it makes the solution easier.
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(ggplot2))
box <- ggplot(data=iris, aes(x=Species, y=Sepal.Length))
box + geom_boxplot(aes(fill=Species)) +
ylab("Sepal Length") + ggtitle("Iris Boxplot") +
stat_summary(fun.y=mean, geom="point", shape=5, size=4) +
coord_flip()
Created on 2020-02-11 by the reprex package (v0.3.0)