Error when trying to make a plot

Hi I'm trying to make a qplot of Marama.oil$Temperature and Marama.oil$Light, but RStudio replies with an error message :confused:

Code:

library(ggplot2)
library(readxl)
library(gridExtra)
Marama <- read_excel('MaramaBeanOilOx.xlsx')
Marama.oil <- subset(Marama, Product=='oil')
qplot(data=Marama.oil,
      + Temperature:Light, sqrt(PV),
      + geom=c('boxplot','jitter'))+
  + facet_grid(.~Month)+theme_bw()

Error msg:

Error: unexpected '=' in:
"      + Temperature:Light, sqrt(PV),
      + geom="

Data of Marama:

Idk if it this part of the code that went wrong:

Marama.oil <- subset(Marama, Product=='oil')

Because when I try to view the data of Marama.oil it says "No data available in table". Is there anyone who knows what I can do to fix this issue so I can create the plot?

Sorry for my english btw

You have mistyped Oil as oil while filtering. Use
Marama.oil <- subset(Marama, Product=='Oil')

see ??qplot for syntax

Thanks I did but now i get this error?

Error in Temperature:Light : NA/NaN argument
In addition: Warning messages:
1: In Temperature:Light :
  numerical expression has 28 elements: only the first used
2: In Temperature:Light :
  numerical expression has 28 elements: only the first used
3: In FUN(X[[i]], ...) : NAs introduced by coercion

Is that due to Na values in the data for Marama.oil aka. the colonne "Air"?

What kind of plot you want to achieve? Explain a little

this looks wrong

Temperature:Light, sqrt(PV)

maybe you meant something like

qplot(data=Marama.oil,
       Temperature, sqrt(PV),
       color=Light,
        geom=c('boxplot','jitter'))+
  facet_grid(.~Month)+theme_bw()

Your post is confusing on this point because you say you want to plot temperature and light, you dont mention this sqrt(PV) ; perhaps you meant

qplot(data=Marama.oil,
       Temperature, Light,
        geom=c('boxplot','jitter'))+
  facet_grid(.~Month)+theme_bw()

and PV is irrelevant ?

Check your syntax, it doesn't make sense

Run this and see if you wanted plot like this

qplot(factor(vs),mpg,
      data = mtcars,
      geom = c("boxplot", "jitter"))+
    facet_grid(.~cyl) + theme_bw()

and make changes to your code

This topic was automatically closed 7 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.