Hello,
I'm posting this again (with some small edits). I didn't get any replies
last time...hoping for some this time. :)
Currently I'm only coming up with brute force solutions to this issue
(loops). I'm wondering if anyone has a better way to do this. Thank you for
your help in advance!
The problem: I have endpoints of one x range (x_rng) and an unknown number
of s ranges (s[#]_rng) also defined by the range endpoints. I'd like to
remove the x ranges that overlap with the s ranges. The examples below
demonstrate what I mean.
What is the best way to do this?
Ex 1.
For:
x_rng = c(-100,100)
s1_rng = c(-25.5,30)
s2_rng = c(0.77,10)
s3_rng = c(25,35)
s4_rng = c(70,80.3)
s5_rng = c(90,95)
I would get:
-100,-25.5
35,70
80.3,90
95,100
Ex 2.
For:
x_rng = c(-50.5,100)
s1_rng = c(-75.3,30)
I would get:
30,100
Ex 3.
For:
x_rng = c(-75.3,30)
s1_rng = c(-50.5,100)
I would get:
-75.3,-50.5
Ex 4.
For:
x_rng = c(-100,100)
s1_rng = c(-105,105)
I would get something like:
NA,NA
or...
NA
Ex 5.
For:
x_rng = c(-100,100)
s1_rng = c(-100,100)
I would get something like:
-100,-100
100,100
or just...
-100
100
PS - You may have noticed that in all of the examples I am including the s
range endpoints in the desired results, which I can deal with later in my
program so its not a problem... I think leaving in the s range endpoints
simplifies the problem.
Thanks!
Ben
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.