After a decade away from R, I'm struggling to debug this code. I'm trying to use summary data to create a plot of means and confidence intervals. Here's the data frame:
plotData
level mean cil ciu
1 1 38.72 38.1 39.34
2 2 45.23 41.6 48.82
3 3 51.75 48.7 54.75
4 4 61.66 61.1 62.20
' ' ' r
#This works without errors
image<-ggplot(plotData,
aes(
x=level,
y=mean
)
)
print(image)
#This gives me the error message "Mapping should be created with aes()
or aes_()
."
image<-ggplot(plotData,
aes(
x=level,
y=mean
)
+
geom_errorbar(mapping = aes(
x=level,
ymin=cil,
ymax=ciu
)
)
+
geom_point(mapping = aes(
x=level,
y=mean
)
)
)
' ' '
I've tried it with and without the "mapping =" and I get the same error. Any ideas how I can fix this?