[R] (no subject)

Jim Lemon jim at bitwrit.com.au
Wed Oct 30 22:38:18 CET 2013


On 10/30/2013 11:03 PM, Stevan Lauriault wrote:
> Hi,
>
> I'm looking for a function that takes a list and calculates a score based on
> how well "like attracts like".
> For example:
>
> list1<- c(john, eric, steve, john, eric, scott, john)
> list2<- c(john, john, john, eric, eric, steve, scott)
>
> score(list1)<  score(list2)
>
> Both lists are composed of the same names and frequency of each
> name.
>
> Not sure how else to put it.  I am relatively new to R.  Have tried the
> modularity function, but can't seem to get it to work for this purpose.
>
>
Hi Steve,
My first guess would be a distance function. Something like the variance 
of the indices of the various names:

by(1:length(list1),list1,var)
by(1:length(list2),list2,var)

How you will handle the NAs generated by single names is another matter.

Jim



More information about the R-help mailing list