[R] data manipulation in R

Patrick Ball lookout_20005 at yahoo.com
Sun Apr 15 23:01:35 CEST 2001


Dear List:

I have a data manipulation problem that I was unable
to solve in R.  I did it in SQL, and it may be that
the solution in R is to do it in SQL, but I wondered
if people could imagine a vector-based solution.  

Imagine a list A[i] of observers who observe some set
of events B[j].  Each observer i may observe one or
more events, and each event j may have been observed
by one or more observers.  Thus the data are a
lower-triangular array AxB where each cell [i,j] has a
zero or one indicating whether observer i saw event j.
 

I am interested in how observers cluster in circuits
whereby observer _a_ sees events _1,2,3_, observer _b_
sees events _2,4,5_, observer _c_ sees event _4_, and
observer _d_ sees _4,6,7_.  Observers a, b, c, d
comprise a circuit linked by the events they jointly
observed.  

Given AxB, how can we use R to articulate the
circuits?  Pseudocode for my SQL solution is below.

For each observation i:  
	- get all the events [j1,j2,...jk] observed by i
	- get all the observations [i_m] which observe one or
more events in  [j1,j2,...jk]
	- count [i_m] 
 	- assign events [i_m] to i's circuit if i_m > i
	- end

What would an R solution look like?  The "get all the"
and the "assign events" are pure SQL reasoning
(select, update).  

Thanks in advance.

Best.

- PB

Patrick Ball, PhD.
Deputy Director
AAAS Science and Human Rights Program
http://shr.aaas.org








__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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