Using this dataset:
dat - read.table(textConnection(daynoRes.QwRes.Q
1 237074.41 215409.41
2 2336240.20 164835.16
3 84855.42 357062.72
4 76993.48 386326.78
5 73489.47 307144.09
6 70246.96 75885.75
7 69630.09 74054.33
8 66714.78 70071.80
9 122296.90 66579.08
10
On Mar 2, 2015, at 11:43 AM, Morway, Eric emor...@usgs.gov wrote:
Using this dataset:
dat - read.table(textConnection(daynoRes.QwRes.Q
1 237074.41 215409.41
2 2336240.20 164835.16
3 84855.42 357062.72
4 76993.48 386326.78
5 73489.47 307144.09
6 70246.96 75885.75
7
Dear Eric,
Here is a solution using the plyr package.
library(plyr)
dat$flg - dat$wRes.Qdat$noRes.Q
dat$group - cumsum(c(0, abs(diff(dat$flg
ddply(dat, group, function(x){
if(x$flg[1] nrow(x) = 5){
x$plygn - seq_along(x$group)
} else {
x$plygn - NA
}
x
})
Best regards,
ir.
3 matches
Mail list logo