Re: [R] sum sections of data of different lengths from within a data frame

2010-02-10 Thread kMan
Dear Kara, Did you bother to test your code? You say your code actually did some summing, but you didn't include any working example of that code. Did you bother to read the posting guide? (1) TRY to reference Col A (including space, as you indicated) in df. >names(df)<-c("Col A", "Col B") #space

Re: [R] sum sections of data of different lengths from within a data frame

2010-02-09 Thread jim holtman
WIll this do it for you: > x <- read.table(textConnection("ColA ColB + 10 + 30 + 21 + 20 + 10 + 40 + 11 + 91 + 30 + 50 + 21"), header=TRUE) > closeAllConnections() > x.s <- split(x, cumsum(x$ColB)) > x.l <- do