This is such a basic question, but I am not able to find an answer to it.
All I want to do is to store all figures to a folder one directory inside where the R script is stored. And I don't want to use full dir, but relative directory, as I work from multiple computers.
So, I have this structure:
/code
/Rscript1
/inputdata
/Rscript2
/figs
fig1
fig2
All I want to do is tell ggplot to store all figures inside "figs" folder instead of the same folder as Rscript1 and Rscript2 (i.e. "code" folder).
scatter<-function(df,x,y){
ggplot(df, aes_string(x=x, y=y)) +
geom_point()+
theme_bw()+
theme(panel.grid.major = element_line(colour = "#808080"))
}
scatter(df=dassmp,x='Oss',y='sa')+
ggsave('fig1.png',width=6, height=4,dpi=300)