[R] "%03d" in the pdf command

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Jul 23 19:26:36 CEST 2005


On Sat, 23 Jul 2005, Dennis Fisher wrote:

> The pdf man page contains the following text:
>
>      pdf(file = ifelse(onefile, "Rplots.pdf", "Rplot%03d.pdf"),
>          width = 6, height = 6, onefile = TRUE, family = "Helvetica",
>          title = "R Graphics Output", fonts = NULL, version = "1.1",
>          paper, encoding, bg, fg, pointsize)
>
> I am creating multi-page graphics in which each page is saved as a
> separate file.  If I invoke onefile=T and I include "%03d" in the
> filename, each page is saved as a separate file.  However, I don't
> understand the "%03d".  Can someone explain?  Am I calling a register
> that contains the page number?

See ?sprintf, or man printf on your system.
It formats the page number in that C format.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list