[Rd] backtick notation

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Aug 7 17:40:32 MEST 2003


Thomas Lumley <tlumley at 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 at biostat.ku.dk)             FAX: (+45) 35327907



More information about the R-devel mailing list