Re: [Rd] Warning on backslash sequences (was sprintf behavior)

2006-09-28 Thread Bill Dunlap
On Thu, 28 Sep 2006, Prof Brian Ripley wrote: > I don't understand why \` is regarded as intentional. It crops up in > packages date and survival (the same code) in > > stop(paste("\`", .Generic, "' not meaningful for dates", > sep = "")) > > which clearly should use s

Re: [Rd] Warning on backslash sequences (was sprintf behavior)

2006-09-28 Thread Prof Brian Ripley
On Thu, 28 Sep 2006, Peter Dalgaard wrote: > "Gabor Grothendieck" <[EMAIL PROTECTED]> writes: > >> That's a good idea for the case I mentioned although there is still >> the case where one requires a single quoted string (maybe for >> generating code for some other language) and that is >> not han

Re: [Rd] Warning on backslash sequences (was sprintf behavior)

2006-09-28 Thread Peter Dalgaard
"Gabor Grothendieck" <[EMAIL PROTECTED]> writes: > That's a good idea for the case I mentioned although there is still > the case where one requires a single quoted string (maybe for > generating code for some other language) and that is > not handled by deparse. Yes, but there be devils lurking

Re: [Rd] Warning on backslash sequences (was sprintf behavior)

2006-09-28 Thread Gabor Grothendieck
On 28 Sep 2006 16:33:17 +0200, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > "Gabor Grothendieck" <[EMAIL PROTECTED]> writes: > > > One area where a problem might appear is if one is > > generating R code, e.g. > > > > paste("a <-", dQuote("xyz")) # wrong! > > > > since in UTF-8 dQuote (and sQuot

Re: [Rd] Warning on backslash sequences (was sprintf behavior)

2006-09-28 Thread Peter Dalgaard
"Gabor Grothendieck" <[EMAIL PROTECTED]> writes: > One area where a problem might appear is if one is > generating R code, e.g. > > paste("a <-", dQuote("xyz")) # wrong! > > since in UTF-8 dQuote (and sQuote) do not necessarily > generate double quotes (and single quotes) so one winds > up u

Re: [Rd] Warning on backslash sequences (was sprintf behavior)

2006-09-28 Thread Gabor Grothendieck
One area where a problem might appear is if one is generating R code, e.g. paste("a <-", dQuote("xyz")) # wrong! since in UTF-8 dQuote (and sQuote) do not necessarily generate double quotes (and single quotes) so one winds up using double quotes within single quotes or else backslash-protecte

Re: [Rd] Warning on backslash sequences (was sprintf behavior)

2006-09-28 Thread Prof Brian Ripley
Thanks, Bill, that is helpful. I've been running a prototype across R itself and CRAN. It is clear that we do have lots of strings with escaped newlines (the escape is generated in the parser if there is an embedded newline) so they need to be an exception. On my first version 99 CRAN package

Re: [Rd] Warning on backslash sequences (was sprintf behavior)

2006-09-27 Thread Bill Dunlap
> > 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 ma

Re: [Rd] Warning on backslash sequences (was sprintf behavior)

2006-09-27 Thread Prof Brian Ripley
On Tue, 26 Sep 2006, Bill Dunlap wrote: > On Mon, 25 Sep 2006 [EMAIL PROTECTED] wrote: > >> On Mon, 25 Sep 2006, [EMAIL PROTECTED] 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