Re: [R] help with splitting parts of data frame

2014-09-28 Thread Charles Berry
Andras Farkas yahoo.com> writes: > > Dear All, > > please help with the following if you can: > [snip details] > > > first24 <-sum(unlist(c(subset(df, df[, 'simt'] > 0 & df[, 'simt'] <= > z[1], 3 > second24 <-sum(unlist(c(subset(df, df[, 'simt'] > z[1] & df[, 'simt'] <= > z[2], 3))

[R] help with splitting parts of data frame

2014-09-28 Thread Andras Farkas
Dear All, please help with the following if you can: we have: simt <-seq(0,147,by=1) simc <-50*exp(-0.01*simt) out1.2 <-data.frame(simt,simc) AUC <-c(0,apply(matrix(simc),2,function(x) (diff(simt)*(x[-1]+x[-length(x)]))/2 )) df <-cbind(out1.2,AUC) z <-cumsum(rep(24,max(out1.2$simt/24)))