From ggrothendieck at gmail.com  Thu Sep 28 17:03:59 2006
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Thu, 28 Sep 2006 11:03:59 -0400
Subject: [Rd] Warning on backslash sequences (was sprintf behavior)
In-Reply-To: <x2odt0jc2a.fsf@viggo.kubism.ku.dk>
References: <20060925094613.B5FB64C91E@slim.kubism.ku.dk>
	<Pine.GSO.4.56.0609260959290.2640@durian.statsci.com>
	<Pine.LNX.4.64.0609270922370.19951@gannet.stats.ox.ac.uk>
	<Pine.GSO.4.56.0609270750050.3216@durian.statsci.com>
	<Pine.LNX.4.64.0609271718410.18168@gannet.stats.ox.ac.uk>
	<971536df0609280655t63ce8be2ie159aba2e6539bc4@mail.gmail.com>
	<x2odt0jc2a.fsf@viggo.kubism.ku.dk>
Message-ID: <971536df0609280803p7e3f35e6jfd6daecfe31496ea@mail.gmail.com>

On 28 Sep 2006 16:33:17 +0200, Peter Dalgaard <p.dalgaard at biostat.ku.dk> wrote:
> "Gabor Grothendieck" <ggrothendieck at gmail.com> 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 using double quotes within single quotes or else
> > backslash-protected double quotes within double quotes.
> >
> > If there were an argument on dQuote and sQuote to
> > specify that they should generate double and single
> > quotes acceptable for code regardless then that would
> > help in this instance.
>
> deparse() would be more to the point, would it not?

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.




[Rd] Warning on backslash sequences (was sprintf behavior)
Gabor Grothendieck