Re: [R] Split in blocks

2013-07-31 Thread arun
Hi, In that case: lst1<-split(ou,cumsum(c(TRUE,diff(ou$V1)==1)))  lst2<-lapply(lst1,function(x) x[x$V1==1,]) A.K. From: Dominic Roye To: arun Sent: Wednesday, July 31, 2013 7:17 PM Subject: Re: [R] Split in blocks Hi,  The thing is that beca

Re: [R] Split in blocks

2013-07-31 Thread arun
Hi, Not clear about your desired output. source("ou.txt") split(ou,ou$V1) #split based on values of "V1" (1 and 0) #or #may be you wanted 1 followed by 0 in one block, again 1 followed by 0 in second block etc.. #In that case: lst1<-split(ou,cumsum(c(TRUE,diff(ou$V1)==1))) A.K. On Wed, Jul

Re: [R] Split in blocks

2013-07-31 Thread Bert Gunter
Enter ?help at the prompt to learn how to use R's (extensive) Help system to answer questions like this. For this question: ?split ## what else? Also ?tapply, ?ave, ?aggregate, ?by may be relevant. Also, read "AN Introduction to R" if you haven't already done so to start learning about R's many

[R] Split in blocks

2013-07-31 Thread Dominic Roye
Hello, I am a little bit lost on my search for a solution and idea. I would like to split my time serie in blocks of "night". V1 indicates if its night or not. How can i split this kind of cases? Best regards, str(ou[,c(1,3,8)]) 'data.frame': 863 obs. of 3 variables: $ Fecha: POSIXct, forma