Gustaf Rydevik wrote: > 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? > Yes, the evaluation rule for "$" is like that....
Notice that it also didn't go looking for an object called A when you said test$A. -- O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
