s-news
[Top] [All Lists]

tapply issue: solutions

To: s-news@wubios.wustl.edu
Subject: tapply issue: solutions
From: vincent.duval@fr.netgrs.com
Date: Tue, 19 Aug 2003 09:51:54 +0200
Thanks to the ones who provided me with answers. 
When everything is put together, it appears that everyone came up with
roughly the same answer:
using sapply and unlist functions.

The clearest option to me was the one provided by Bert Gunter which does
exaxctly what I want, i.e getting a dataframe with the cumulative sum at
each observation for each patients.
        out<-tapply(temp$tex,list(temp$id),cumsum)
        l.out<-sapply(out,length)
        out.df<-data.frame(id=rep(names(out),l.out),csum=unlist(out))

I tried the function aggegate suggested by Adrienne but I could not sorted
out what was going wrong but it doesn't work yet.

Thanks to everyone and have a nice day,

Vincent

<Prev in Thread] Current Thread [Next in Thread>
  • tapply issue: solutions, vincent . duval <=