[R] Selecting transitive couples

Agustin Lobo alobo at ija.csic.es
Tue Nov 13 17:55:10 CET 2001


Dear list,

I'm trying to improve the following process:

Let pairs be a 2 col matrix of integers such as:

2 5
3 6
4 56
5 2
6 8
7 56
8 6
etc.

My goal is to select the transitive pairs, i.e., in
the above example:

2 5 (because there is 5 2 as well)
6 8 (because there is 8 6 as well)

The task is simple with a for loop, but
can anybody suggest a "genuine R" solution?
(That is, a vectorised operation).

Note that, in practice, matrix pairs
can have ~60000 rows.

Thanks

Agus

Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list