From xie at yihui.name  Sat Jan 21 19:50:14 2012
From: xie at yihui.name (Yihui Xie)
Date: Sat, 21 Jan 2012 12:50:14 -0600
Subject: [Rd] bug in pdf(file = NULL)
Message-ID: <CANROs4cPoTPBtBBqRn=cSp7=bAbnG_tS-SoLQsVVf8uCM82Vcw@mail.gmail.com>

Hi,

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
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



[Rd] bug in pdf(file = NULL)
Yihui Xie