[R] Converting rankings to paired-comparisons
    Iuri Gavronski 
    iuri at ufrgs.br
       
    Tue Jan 20 10:19:01 CET 2009
    
    
  
Hi,
I need to convert a ranking dataset (actually, it is an ipsative
scale) to paired-comparisons.
For example, if I have this data:
x <- matrix(c(10,20,30,40,0,
    10,10,10,10,50,
    30,30,30,5,5), nrow=3, ncol=5, byrow=TRUE,
    dimnames = list(1:3, letters[1:5])
)
For every pair of data, I would need to apply a transformation like:
if a < b, ab = 0, otherwise ab=1
In the end, I need a matrix like that:
ab ac ad ae bc bd be cd ce de
0  0  0  1  0  0  1  0  1  1
1  1  1  0  1  1  0  1  0  0
1  1  1  1  1  1  1  1  1  1
Would anyone suggest a "no loops" way for doing that?
By the way, I would need to apply a tetrachoric correlation to this
output matrix. Should I use package polycor? Any thoughts would be
welcome.
Thanks,
Iuri.
    
    
More information about the R-help
mailing list