Skip to content
Prev 274218 / 398506 Next

loop function within a loop

It's better to avoid loop in this situation. If you want to reorder
subsets of the data based on event, the follow works

df<-read.table('clipboard',header=TRUE)
sp.or<-lapply(split(df,df$group),function(ldf) ldf[order(ldf$event),])
new.df<-do.call('rbind',sp.or)

Weidong Gu
On Wed, Oct 12, 2011 at 10:55 AM, Sally Zhen <saliluna at gmail.com> wrote: