Help using ggplot2: I can perfectly plot one variable but the other keeps returning an error

You're right. They look identical, except for ylim(0,2.5), but ggplot is unconvinced. The message is a complaint that labs(y="Mean ISI ± SE", x="Site") isn't being tacked on to a ggplot object.

These are hard to eye-check and a little sample from anovadata would make a nice reproducible example, called a reprex.



and see if it produces output, which is pretty good evidence that you do have a ggplot object, and v.v.

If that works

RichPlot + labs(y="Mean Total Species Richness ± SE", x="Site")

to see if you still get the error message.

If you don't, put spaces around <-