R-alpha: User friendly functions

Kurt Hornik
Mon, 14 Apr 1997 16:57:44 -0000

>>>>> Peter Dalgaard BSA writes:

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

Something like that would be very nice to have.

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