# [R] select integer intervals from a integer space

David Winsemius dwinsemius at comcast.net
Wed Dec 7 16:40:33 CET 2011

```On Dec 7, 2011, at 10:11 AM, Mao Jianfeng wrote:

> Dear r-helpers,
>
> I have an one-dimensional integer space (defined by random integer
> intervals, which overlapped each other or not). I would like to select
> consecutive integer intervals with specific intra and inter length.
>
> Here, an integer interval means a set of consecutive increasing
> integers,
> defined by a begin integer and an end integer.
>
> This question has ever been asked here (
> http://stackoverflow.com/questions/8413990/selecting-integer-intervals-with-specific-intra-inter-length-from-random-integer)
> .
> Though it has attracted some responses, but I still have not
> hints of solution.

Because you have a poorly posted problem. As far as I can tell you
have not yet responded constructively to the attempts at clarification
of the problem. Cross-posting to this list after waiting only 4 hours
with an identical problem is bad Rhelp behavior.  You should use the
interactive facilities at SO and better respect the efforts already

>
> response in
> stackoverflow webpage. Thanks a lot in advance.
>
> Best wishes,
>
> Jian-Feng,
>
>
> I describe my question using the following dummy.
>
> ##############################
>
> # (1) the data (integer space consist of integer intervals defined
> by their
> begin and end) I have,
>
> integer.space <- data.frame(begin=c(1,5,6,15,31,51,102),
> end=c(7,9,13,21,49,52,109))
>
>
> #####################################
>
> # (2) what I want is to select the consequent integer intervals with
> # intra-length of 3 and inter-length of 2. and output the selected
> # intervals as begin and end. In this selection, I would like to
> select
> # more integer intervals as most as it could be.
> # the following are intervals I expected to be selected from the
> dummy data
>
> begin,end
> 1,3
> 6,8
> 11,13
> 16,18
> 31,33
> 36,38
> 41,43
> 46,48
> 102,105

Last item does NOT have length of 3. Why have you not responded to
this observation on SO? And why would there not also be another line
in the sequence after 102,104 that would be 106,108? My suggestion
would be to go back to SO and be a better citizen.

>
> 	[[alternative HTML version deleted]]

Posting in HTML is also  bad citizenship on R-help.

>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help