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.

______________________________________________
R-help@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.

Reply via email to