Very new to Rmarkdown and I have been trying to knit it to pdf. However, it displays the following error message: ERROR: stat_smooth requires the following missing aesthetics: x, y
The line it has a problem with is this:
ggplot(GWASRAW, aes(x=GWASRAW$BASE_AGE1_R1, y=GWASRAW$BIO_MTB_LIPID_CE_R1, color=GWASRAW$BASE_SEX_R1)) + geom_point() + geom_smooth(method=`loess`) + scale_color_manual(values=c("darkmagenta", "darkcyan"), name= "Sex", labels=c("Female", "Male")) + xlab("Age (years)") + ylab("Cholesteryl esters (micromol)")
I have specified all the packages needed in a previous chunk and established the path to the dataset (GWASRAW) in a previous chunk, which does run
GWASRAW <- read.csv2('/Volumes//GWASRAW.RData')
I have also tried specifying x and y by copying aes(x=GWASRAW$BASE_AGE1_R1, y=GWASRAW$BIO_MTB_LIPID_CE_R1, color=GWASRAW$BASE_SEX_R1) into the geom_smooth() code.
However, it still gives this error. Can anyone help me?