[R] Ranking correlation with R

Joshua Wiley jwiley.psych at gmail.com
Fri Apr 9 17:48:46 CEST 2010


Dear David,

Are the rankings the numbers? Like....

List 1:
1
3
2

If so you should be able to do it fairly easily with cor()  If you
have a lot of file names and need to extract the numbers look at
?strsplit or ?substring.  This will be easier or harder depending how
variable the names are.  For instance with your example names

>  x <- c("file1.java","file2.java")
> as.numeric(substring(x,5,5))
[1] 1 2

but this assumes that there is only 1 number and that it always occurs
as five characters from the left.


Best regards,


Joshua


On Fri, Apr 9, 2010 at 8:22 AM, David Nemer <davidnemer at gmail.com> wrote:
> Hey Everyone,
>
> Im fresh new in R, and Im supposed to write a code to give me a correlation
> between two rankings. So I have two ranking lists, which contain file names,
> e.g.:
>
> Ranking list 1:
> file1.java
> file3.java
> file2.java
>
> Ranking list 2:
> fiile2.java
> file4.java
> file1.java
>
> I need to see how much are these two ranking lists are alike, get a
> correlation between them. I dont even know where to start. Can anyone bring
> me some light or tips? Thank you in advance.
>
> Cheers,
> --
> David Nemer
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



-- 
Joshua Wiley
Senior in Psychology
University of California, Riverside
http://www.joshuawiley.com/



More information about the R-help mailing list