R-alpha: User friendly functions

Peter Dalgaard BSA
Tue, 08 Apr 1997 17:27:48 -0000

A loose idea for *post*-0.50 development

I've been giving a some (but not all that many) thoughts to whether
some of the conceptual difficulties facing newcomers could be avoided
by having simplified functions for common operations. We already have
parts of this, e.g. in Kurts ctest routines. Specifically, I was
thinking about data frames: How about

dfr.sel<-select.frame(dfr,age,sex,pain1:pain5)

with the : specifying a range, instead of

dfr.sel<-dfr[,c(1,2,5,6,7,8,9)]

or

attach(dfr)
dfr.sel<-data.frame(age,sex,pain1,pain2,pain3,pain4,pain5)
detach(dfr)

(which isn't even safe if there are variables of the same name in the
global environment)

similarly, how about

dfr.sub<-subset.frame(dfr,sex==1 && age > 30)

rather than

dfr.sub<-dfr[dfr$sex==1 && dfr$age > 30,]

Both would seem to be quite possible to implement, although they do
need to do some sneaky bits of computing-on-the-language internally.

--
   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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-