Re: [R] Counting number of consecutive occurrences per rows

2013-05-06 Thread PIKAL Petr
s it what you want? Petr From: zuzana zajkova [mailto:zuzu...@gmail.com] Sent: Friday, May 03, 2013 7:10 PM To: PIKAL Petr; jholt...@gmail.com Cc: r-help@r-project.org Subject: Re: [R] Counting number of consecutive occurrences per rows Hi, I'm sorry that it takes me so much time to respond,

Re: [R] Counting number of consecutive occurrences per rows

2013-05-03 Thread zuzana zajkova
limits, include.lowest=T))) > res <- rep(rrr$lengths, rrr$lengths) > res > } > > you can use split/lapply approach > > test$res2<-unlist(lapply(split(test$act, factor(test$day, levels=c(1,0))), > fff)) > > Beware of correct ordering of days in output. Without

Re: [R] Counting number of consecutive occurrences per rows

2013-04-29 Thread PIKAL Petr
[0,1] 4 2 14655 (1,199] 1 3 14655 (199,200] 2 Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of zuzana zajkova > Sent: Monday, April 29, 2013 12:45 PM > To: r-help@r-project.org > Subject

Re: [R] Counting number of consecutive occurrences per rows

2013-04-29 Thread jim holtman
try this: > test <- structure(list(jul = structure(c(14655, 14655, 14655, 14655, + 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, + 14655, 14655, 14655), origin = structure(0, class = "Date")), + time = structure(c(1266258354, 1266258954, 1266259554, 1266260154, + 126626075

Re: [R] Counting number of consecutive occurrences per rows

2013-04-29 Thread jim holtman
Forgot the last part of the question: > test <- structure(list(jul = structure(c(14655, 14655, 14655, 14655, + 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, + 14655, 14655, 14655), origin = structure(0, class = "Date")), + time = structure(c(1266258354, 1266258954, 1266259554,

[R] Counting number of consecutive occurrences per rows

2013-04-29 Thread zuzana zajkova
Hi, I would appreciate if somebody could help me with following calculation. I have a dataframe, by 10 minutes time, for mostly one year data. This is small example: > dput(test) structure(list(jul = structure(c(14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 1