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

From: Ted Harding <>
Date: Sun 24 Jul 2005 - 07:23:08 EST

On 23-Jul-05 Prof Brian Ripley wrote:

> 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.

If it's still obscure, the effect of the format string "Rplot%03d.pdf" is that a string is generated consisting of the characters


followed by

  an integer of width 3 digits (padded to the left with zeros   if required to make the width equal to 3),

followed by the characters


where the value to be inserted in place of "%3d" will be derived from somewhere -- not specified in the command itself but deducible from "?pdf": If onefile=TRUE then you get all figures in a single file whose name is "Rplots.pdf", otherwise you get them succesively in separate files with names



after which you run out of road.

Hoping this helps,

E-Mail: (Ted Harding) <> Fax-to-email: +44 (0)870 094 0861
Date: 23-Jul-05                                       Time: 22:22:15
------------------------------ XFMail ------------------------------

______________________________________________ mailing list PLEASE do read the posting guide! Received on Sun Jul 24 08:24:25 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:58 EST