[R] (no subject)

Siri Bjoner bjoner at combitel.no
Fri Jan 28 16:59:50 CET 2011


This looks like homework. We don't do homework. Certainly not when you  
obviously haven't a) read the posting guide, b) asked your  
professor/tutor, c) googled to see if you find something online, d) at  
least made an effort to try, and e) read the posting guide.

Do all the points above and then try posting again.

Siterer "Marine Andersson" <Marine.Andersson at ki.se>:

> Hello,
> I have a data set with each column containing data like this:
> row column1
> 1 1.2
> 2 NA
> 3 NA
> 4 3
> 5 5
> 6 NA
> 7 1.5
> 8 NA
> 9 NA
> 10  NA
> 11 3
> 12 NA
> 13  3
> 14  NA
> 15 NA
> 16 NA
> 17 NA
> 18 3
> 19 1.2
> 20 NA
>
>> From this I would like to extract the sequence containing at least  
>> three rows of 3 in a row (exlcuding NAs). I would also like to have  
>> the row numbers showing the place of the last number unequal to 3  
>> befor the first 3 in the sequence and the place of the next number  
>> after the last 3 in the sequence.
> So in this example I would get  11 to 18 as the sequence rows and  
> row 7 to 19 as the rows showing the numbers before and after that  
> are unequal to three.
> The rle does not work since it is not possible to exlude the NAs.
>
> I hope you understand the question. All help is highly appreciated.
>
> /Marine
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list