transmetro transmetro - 2 months ago 7x
R Question

Call plot() in R without producing a plot

I have written some plot methods that I want to do automated unit tests on in R with

. Doing so fills my test script folder with plot files, which is a nuisance.

My Q: is there a way to plot to a device that just throws the plot away? Sort of like writing a file to


From help("pdf"):

file: a character string giving the name of the file. If it is of the form "|cmd", the output is piped to the command given by cmd. If it is NULL, then no external file is created (effectively, no drawing occurs), but the device may still be queried (e.g., for size of text).


pdf(file = NULL)

doesn't produce any output.