From p.dalgaard at biostat.ku.dk  Thu Aug  7 17:40:32 2003
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard BSA)
Date: Thu Aug  7 18:40:35 2003
Subject: [Rd] backtick notation
In-Reply-To: <Pine.A41.4.44.0308070843200.142036-100000@homer06.u.washington.edu>
References: <Pine.A41.4.44.0308070843200.142036-100000@homer06.u.washington.edu>
Message-ID: <x2r83xbek9.fsf@biostat.ku.dk>

Thomas Lumley <tlumley@u.washington.edu> writes:

> On Thu, 7 Aug 2003, Gabor Grothendieck wrote:
> 
> >
> > Could someone explain the thinking behind the backtick notation in
> > r-devel?
> >
> > I think I understand that it can be used to refer to variable names
> > which would otherwise not conform to R syntax; however, assign and
> > as.name already allow you to do this.  Is there more to it than that?
> 
> assign and as.name are fairly limited.  For example, if you have a list or
> data frame whose name is syntactically invalid it is quite difficult to
> access or modify its columns.

Yes. `weight in kg`[101]<-55 is pretty difficult to do with get() and
assign() and lm(`weight in kg`~I(`height in m`^2)) is tricky too. The
use is sort of similar to the single quotes in shell programming (but
not quite). The choice of the backtick as quoting delimiter was mostly
because that was the only one available....

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] backtick notation
Peter Dalgaard BSA