[R] Reorganizing rows and columns
kewley at eden.rutgers.edu
kewley at eden.rutgers.edu
Sun Apr 23 23:17:52 CEST 2006
I'm sure this is a simple task, but how to do it has escaped me.
I have imported data from two separate files (each file contains the
results from an information retrieval algorithm) organized into a list.
They are organized by File,Query, and Rank (in that order):
[[1]]
Doc Query Rank
5 1 1
9 1 2
7 1 3
5 2 1
7 2 2
9 2 3
[[2]]
Doc Query Rank
4 1 1
5 1 2
9 1 3
8 2 1
5 2 2
7 2 3
I need to rearrange the data so that it is sorted by Query and Document,
with columns for rank1 and rank2 (from files 1 and 2, respectively). For
example:
[[1]]
Doc Query Rank1 Rank1
4 1 NA 1
5 1 1 2
7 1 3 NA
9 1 2 3
5 2 1 2
7 2 2 3
8 2 NA 1
9 2 3 NA
My goal is to perform a Spearman/Kendall test to check the correlation
between the rankings.
Any help would be appreciated.
Andrew Noyes
More information about the R-help
mailing list