[R] Finding all overlaps between two sets of 1-Dimensional regions
Dimitris Rizopoulos
dimitris.rizopoulos at med.kuleuven.be
Fri Sep 2 16:05:13 CEST 2005
maybe something like this could work in your case:
set1 <- t(apply(matrix(rnorm(20), 10, 2), 1, sort))
set2 <- t(apply(matrix(rnorm(10), 5, 2), 1, sort))
########################
set1. <- apply(set1, 1, rev)
apply(set2, 1, function(x) apply(set1. <= x, 2, any))
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Sean Davis" <sdavis2 at mail.nih.gov>
To: "r-help" <r-help at stat.math.ethz.ch>
Sent: Friday, September 02, 2005 3:17 PM
Subject: [R] Finding all overlaps between two sets of 1-Dimensional
regions
>I have a simply defined regions ([start,end] where start<end). I
>have two
> large sets of them and want to find all regions in the first that
> overlap
> any regions in the second. The closest I could find by searching is
> overlap.owin in I can do this by looping, but there is likely a
> better way
> to do this. Any suggestions?
>
> Thanks,
> Sean
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
More information about the R-help
mailing list