use pdf(file = NULL) in R > 2.14.0 #9

Closed
yihui opened this Issue Nov 2, 2011 · 3 comments

Projects

None yet

1 participant

@yihui
Owner
yihui commented Nov 2, 2011

Paul has added support to file = NULL in the pdf() device in rev.57541, which acts like a null device. This will make knitr even faster. Testing code:

x = rnorm(1000)
system.time({
    .Call("R_GD_nullDevice", PACKAGE = "grDevices")
    replicate(500, plot(x, pch = 1:21))
    dev.off()
})
system.time({
    pdf(file.path(tempdir(), "Rplots.pdf"))
    replicate(500, plot(x, pch = 1:21))
    dev.off()
})
system.time({
    png(file.path(tempdir(), "Rplots.png"))
    replicate(500, plot(x, pch = 1:21))
    dev.off()
})
system.time({
    pdf(file = NULL)
    replicate(500, plot(x, pch = 1:21))
    dev.off()
})
@yihui yihui added a commit that referenced this issue Nov 10, 2011
@yihui a note on #9 d2b2239
Owner
yihui commented Dec 8, 2011

R 2.14.1 is scheduled for December 22, so it won't take too long for this issue

@yihui yihui closed this in 133e8e5 Jan 13, 2012
Owner
yihui commented Jan 15, 2012

Sigh... pdf(file = NULL) actually produces a file named NA, which makes it meaningless as a null device; reported to Paul and R core: https://stat.ethz.ch/pipermail/r-devel/2012-January/063070.html

In the devel version of knitr, I added code to remove this NA file, but this is really not a good fix.

@yihui yihui reopened this Jan 21, 2012
Owner
yihui commented Feb 10, 2012

OK, Ripley said this had been fixed: https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14808

@yihui yihui closed this in 5ea194e Mar 6, 2012
@takluyver takluyver referenced this issue in hadley/evaluate Apr 1, 2014
Merged

Avoid creating Rplots files #44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment