ggplot2 error message when trying to create plot

when trying to plot some data that I just read in, I got this error message. What can I do to fix it?

The last command is the correct syntax. Now,

> Vom_plot

R does not like my code above that line, below is what it says:
VOM_plot<-ggplot(aes(Month,VOM, data=dat))
Error: data must be a data frame, or other object coercible by fortify(), not an S3 object with class uneval
Did you accidentally pass aes() to the data argument?

Hey!
You kinda got it right in the last line in the console in your snapshot.
So, you should do sth like this

VOM_plot<-ggplot(data = dat, aes(Month, VOM))
VOM_plot

However, this won't show anything, since you are not specifying any geom. For instance, you could have a simple scatter plot like this:

VOM_plot <- ggplot(data = dat, aes(Month, VOM)) + 
   geom_point()

VOM_plot

HTH


This post was published by an Appsilon team member. Our company can help you get the most out of RShiny and Posit/RStudio products.

Check our open positions here.

Appsilon: Building impactful RShiny Dashboards and providing R coding services.
Appsilon_GIFsmall_whitebg

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.