Re: [Rd] sprintf behavior (PR#9250)

From: Bill Dunlap <>
Date: Tue 26 Sep 2006 - 17:12:22 GMT

On Mon, 25 Sep 2006 wrote:

> On Mon, 25 Sep 2006, wrote:
> ...
> > sprintf("\p") doesn't show the backslash, this occurs with all strings that
> > start with certain letters. There is however no explanation to this behavior.
> There is: see ?Quote (and C behaves in the same way).
> > And there seems to be no way to get a guaranteed backslash in sprintf.
> "\\", see the FAQ 7.8 for example.

Splus's parser emits a warning when it sees a backslash outside of the recognized backslash sequence. E.g.,

  > nchar("\Backslashed?")
  [1] 12
  Warning messages:
    The initial backslash is ignored in \B -- not a recognized escape sequence.

          Use \\ to make a backslash

You might want to add that warning to R's parser. I've seen the error in several R packages. E.g.,

  bayesmix/R/JAGScontrol.R: text[4] <- "-inits.R\"\n\initialize\n"   SciViews/svDialogs/R/fixedDlg.wxPython.R: if (length(grep("[\.]", basename(res))) == 0)

The warning is mostly emitted when the error is benign, but it might help get people to think about what they are typing.

Bill Dunlap
Insightful Corporation
bill at insightful dot com

 "All statements in this message represent the opinions of the author and do  not necessarily reflect Insightful Corporation policy or position." mailing list Received on Wed Sep 27 03:17:43 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 27 Sep 2006 - 09:30:09 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.