[R] The "$" operator and vectors

Gustaf Rydevik gustaf.rydevik at gmail.com
Fri Jul 13 11:17:10 CEST 2007


Hi all,

I've run into a slightly illogical (to me) behaviour with the "$"
subsetting function.

consider:
> Test
  A B
1 1 Q
2 2 R

> Test$A
[1] 1 2

> vector<-"A"
> Test$vector
NULL

> Test$"A"
[1] 1 2

> Test[,vector]
[1] 1 2


Is there a reason for the $ operator not evaluating the vector before executing?

best,

Gustaf


-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451 /+46(0)8 760 52 93
address: C/O Rydevik, Syrenv. 12, 17851 Ekerö, SE
skype:gustaf_rydevik



More information about the R-help mailing list