\begin{Schunk}
\begin{Sinput}
 SAVEME <- FALSE
 if (SAVEME){
    pdf(file = "afilename.pdf", paper = "special", 
       height = 5, width = 7, onefile = FALSE, family = "Times")
  } else {
    ## If you are not using Rstudio, this works in an interactive session
    if (interactive()) dev.new(height = 5, width = 7)
  }
 plot(y ~ x, data = dat, xlab = "My super plot", ylab = "My other variable", main = "smarter than you")
 lines(z ~ x, data = dat, col = "green")
 if (SAVEME) dev.off()
\end{Sinput}
\end{Schunk}
