[R] is it safe to replace every "<-" by "=" in R code?

Jim Lemon jim at bitwrit.com.au
Mon Jan 14 09:58:22 CET 2008


Charilaos Skiadas wrote:
> And of course let's not forget that a particularly twisted individual  
> could overwrite "=":
> 
>  > `=` <- function(x,y) print(x+y)
>  > 3 = 4
> [1] 7
>  > 3 <- 4
> Error in 3 <- 4 : invalid (do_set) left-hand side to assignment
> 
> 
> I also was for a while mystified by the <- assignment, and preferred  
> = instead, but have since grown out of it, and now find <- more clear  
> (especially since it makes the separation between function arguments  
> and assignments clear).
> 
> I now have a problem whenever I switch to another programming  
> language ....
> 
Except APL, of course.

Jim




More information about the R-help mailing list