[R] Ranking correlation with R

Joshua Wiley jwiley.psych at gmail.com
Fri Apr 9 19:35:52 CEST 2010

On Fri, Apr 9, 2010 at 10:23 AM, David Nemer <davidnemer at gmail.com> wrote:
> Would that also work if in one ranking I have a filename that it is not in
> the other ranking?

match() will return an NA, if it cannot find a match, in which case
you could use the argument: use="pairwise.complete.obs") in cor() to
have it only use pairs with complete data.

> Eg:
> Ranking X:
> A
> B
> C
> Ranking Y:
> A
> D
> C

In this example, you would get a correlation of 1, because B from x
does not match anything in y, and D from y does not match x, so you're
left with A and C which are in the same positions.

> --
> David Nemer

Joshua Wiley
Senior in Psychology
University of California, Riverside

More information about the R-help mailing list