[R] How to make "<-" generic?

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sat Jul 26 12:02:37 CEST 2003


Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:

> What are you trying to do with this?  Assignment (<-) is not a function,
> and the language grammar does not convert a <- b into "<-"(a, b) (as it
> would with the binary operator functions).  You could call it that way,
> and then it will probably work.

Eh? Are you sure about that???

> quote("<-"(a,b))
a <- b
> e <- quote(a<-b)
> e[[1]]
<-
> e[[2]]
a
> e[[3]]
b
> "<-"<-get("+") # Don't try this at home, kids...
> 2<-2
[1] 4
> rm("<-")
> 2<-2
Error in 2 <- 2 : invalid (do_set) left-hand side to assignment


-- 
   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-help mailing list