[R] row by row similarity

From: Grant Gillis <grant.j.gillis_at_gmail.com>
Date: Sun, 06 Apr 2008 11:07:22 -0700

Hello all and thanks in advance for any advice. I am very new to R and have searched my question but have not come up with anything quite like what I would like to do.

My problem is:

I have a data set for individuals (rows) and values for behaviours (columns). I would like to know the proportion of shared behaviours for all possible pairs of individuals. The sum of shared behaviours divided by the total. There are zeros in the data that I would like treated as the behaviour does not exist.

example data format:

ind B1 B2 B3 B4 B5 B6

w       2    1    5    3    4    4
x       1    2    3    4    5    6
y       1    3    5    2    7    6
z       2    3    2    4    2    6

Desired output:

w x 0
w y 0.166667
w z 0
x y 0.33333
x z 0.33333



        [[alternative HTML version deleted]]

R-help_at_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. Received on Sun 06 Apr 2008 - 18:10:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 06 Apr 2008 - 20:31:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive