Bug 14808 - bug in pdf(file = NULL)?
bug in pdf(file = NULL)?
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Graphics
R 2.14.1
x86_64/x64/amd64 (64-bit) Linux-Ubuntu
: P5 enhancement
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-09 04:35 UTC by Yihui Xie
Modified: 2012-02-10 08:15 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yihui Xie 2012-02-09 04:35:49 UTC
Hi,

I reported this issue a few weeks ago in r-devel but I did not get a response, so I come here instead. I appreciate if someone can take a look at it.

pdf(file = NULL) will actually create a file named NA, which is
inconsistent with its documentation. A minimal example:

pdf(file = NULL)
plot(1)
dev.off()

Perhaps this is a bug?

> list.files(pattern = '^NA$')
character(0)
> pdf(file = NULL)
> plot(1)
> dev.off()
null device
         1
> list.files(pattern = '^NA$')
[1] "NA"
> sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C                 LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

Regards,
Yihui
Comment 1 Brian Ripley 2012-02-10 08:15:16 UTC
Doesn't do this in R-devel.

Changes now ported to R-patched.