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

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Mon 25 Sep 2006 - 09:51:49 GMT

michael.bauer@lo-res.org writes:

> Full_Name: Michael Bauer
> Version: 2.3.1
> OS: Mac OS X 10.4.7
> Submission from: (NULL) (131.130.124.155)
>
>
> > sessionInfo()
> Version 2.3.1 (2006-06-01)
> powerpc-apple-darwin8.6.0
>
> attached base packages:
> [1] "methods" "stats" "graphics" "grDevices" "utils"
> [6] "datasets" "base"
> >
>
> 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.
> And there seems to be no way to get a guaranteed backslash in sprintf.

This is *not* a bug (it is also not a FAQ, although I'm beginning to think it should be). Please read up on R's string handling, with particular emphasis on the concept of escape characters.

> "\\p\n"

[1] "\\p\n"

> cat("\\p\n")

\p

> nchar("\\p\n")

[1] 3

Also, do not report things as bugs before you are 100% certain that they are bugs.

-- 
   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon Sep 25 19:53:37 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 Mon 25 Sep 2006 - 10:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.