Here is the code I used:
library(ggplot2)
pdf('testplot.pdf')
qplot(1:10, 2:11, geom=c('point', 'line'))
dev.off()
If i type these into an R session, everything is fine, but if I save these lines to a file test.R
, and then source it, the pdf file would be empty. Very puzzling.