Displaying 2 results from an estimated 2 matches for "cterm1_p0h".
2013 Feb 01
29
cumulative sum by group and under some criteria
Thank you very much for your reply. Your code work well with this example.
I modified a little to fit my real data, I got an error massage.
Error in split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...) :
Group length is 0 but data length > 0
On Thu, Jan 31, 2013 at 12:21 PM, arun kirshna [via R] <
ml-node+s789695n4657196h87@n4.nabble.com> wrote:
> Hi,
> Try this:
>
2013 Mar 10
0
max row
...NA;?
>>>>x[,9:10][x$Qm<=c11,]<-cumsum(x[,5:6][x$Qm<=c11,]);?
>>>>x[,11:12][x$Qn<=c12,]<-cumsum(x[,5:6][x$Qn<=c12,]);
>>>>x[,13:14]<-cumsum(x[,5:6]);?
>>>>colnames(x)[9:14]<- c("cterm1_P0L","cterm1_P1L","cterm1_P0H","cterm1_P1H","sumTerm1_p0","sumTerm1_p1");?
>>>>x1<-na.locf(x);?
>>>>x1[,9:14][is.na(x1[,9:14])]<-0;?
>>>>x1}
>>>>))?
>>>>row.names(d2)<-1:nrow(d2)
>>>>
>>>>head(d2)
>...