I use Jupyter laptops working with the R kernel (3.2.2) in OSX, working through some basic statistical exercises. A few days ago, I first played with ggplot and ran some commands from a laptop cell, experimenting with printing in pdf files, in other words, using something like the following: pdf("file.pdf"); plot(x, y); dev.off() pdf("file.pdf"); plot(x, y); dev.off() pdf("file.pdf"); plot(x, y); dev.off() I have not saved any of these cell contents, so I can’t see exactly what I started, but can I assume that I can create some pdf files and not include the dev.off () command?
My problem is that from this session now every cell that I run on any laptop (including new blank ones) creates an unwanted PDF file. If this code includes drawing construction, then pdf contains this number, if the code is something else, the pdf created cannot be opened. I cannot find a way, elegant or cruel, to stop the creation of these PDF files.
If I switch to a new blank notebook:
running dev.list() returns pdf: 2
dev.cur() returns pdf: 2
dev.off() returns null device: 1
but then, if right after that, I run dev.list() or dev.cur() again, they again return pdf: 2
I can open additional new devices, and dev.off() will be able to close them. But this pdf: 2 device will not disappear. I tried to end all sessions, reboot my machine, etc., but to no avail; Suggestions?
Also, if I run the pdf () command from a console in a terminal (i.e. not from a laptop), my graphs show that they are generated by Quartz; I understand that this may be a problem with quartz, and not a problem with R, but my question remains, how to close this device or otherwise stop the creation of all these PDF files?