Code where I have to explicitly decleare pdf
to get even one page output into filesystem with RStudio, but failing to get two pages on the filesystem target
library("ggplot2")
library("datasets")
options(device="pdf") # https://stackoverflow.com/questions/6535927/how-do-i-prevent-rplots-pdf-from-being-generated
filename.pdf <- paste0(getwd(), "/", "Rplots", ".pdf", sep = "")
pdf(file=filename.pdf)
data(iris)
plot(iris)
dat.m <- data("mtcars")
print(head(dat.m))
ggplot(data=mtcars, aes(x=mpg, y=hp, colour=factor(cyl))) + geom_line() # https://stackoverflow.com/a/38278702/54964
# TODO Output nothing so wrong!
print(getwd())
print(warnings())
dev.off() # nenecssary with RStudio
Output in RStudio: one page
Output in Rscript: two pages
Expected output: two pages
Prompt output in all where no errors
[1] "/home/masi/Workspace"
Warning message:
In sink() : no sink to remove
OS: Debian 9
RStudio: 1.0.143
R: 3.4.0