[R] The

THK tkeitt at gmail.com
Fri Jul 13 11:36:18 CEST 2007


Gustaf Rydevik <gustaf.rydevik <at> gmail.com> writes:
 
> Is there a reason for the $ operator not evaluating
> the vector before executing?

Yes. Consider:

> x <- list(a = 1, b = 'n')
> a <- 'b'
> x[[a]] == 'n'
[1] TRUE
> x[['a']] == 1
[1] TRUE
> x$a == ???

If the result is 'n', then all bare $ references would require
quotes to avoid name collisions.

THK

> 
> best,
> 
> Gustaf
>



More information about the R-help mailing list