[R] Efficiency of subsetting with x[someCode] or test<-someCode and x[test]

Gregor Gorjanc gregor.gorjanc at gmail.com
Thu Jul 6 23:42:28 CEST 2006


Hello!

Does anyone have any knowledge on efficiency of subsetting via

x[someCode]

or

ind <- someCode
x[ind]

In first approach I find it sometime cumbersome if someFunc() is
something complex i.e. long code, but it is short otherwise. I wonder if
assigning result to some indicator object is less efficient since
"copies" result is first stored and then reused. Is there any general
way with this that one should go for?

Thanks!

-- 
Lep pozdrav / With regards,
    Gregor Gorjanc

----------------------------------------------------------------------
University of Ljubljana     PhD student
Biotechnical Faculty
Zootechnical Department     URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3                   mail: gregor.gorjanc <at> bfro.uni-lj.si

SI-1230 Domzale             tel: +386 (0)1 72 17 861
Slovenia, Europe            fax: +386 (0)1 72 17 888

----------------------------------------------------------------------
"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.



More information about the R-help mailing list