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 received any
hints of solution.

I expect to hearing your helps/advice/directions in email or 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

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to