R-alpha: User friendly functions
Peter Dalgaard BSA
p.dalgaard@kubism.ku.dk
14 Apr 1997 19:28:06 +0200
Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> writes:
> > dfr.sel<-select.frame(dfr,age,sex,pain1:pain5)
>
> > dfr.sub<-subset.frame(dfr,sex==1 && age > 30)
>
> Something like that would be very nice to have.
I got a working select.frame() during the weekend. Really easy, once you
get the hang of constructions of the type
eval(as.call(subst.expr(c(as.name("c"),expression(...)))))
- with subst.expr() recursively replacing call arguments with
corresponding numbers using match(). As a bonus, it is actually
possible to do stuff like
select.frame(psychometry,seq(scale1.before,scale15.before,2))
and get every *second* variable in the range (skipping "after"
measurements)
Next: subset.frame() - before I do the obvious: Is there a simple way
of getting R to search a frame *before* the global environment?
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-