[R] R suitability for development project

Jim Lemon jim at bitwrit.com.au
Mon Sep 3 13:41:25 CEST 2012


Eric Langley wrote:
> Hello All,
>
> Eric Langley here with my first post to this list. I am looking to
> determine if R is suitable for a development project I am working on
> and if so possibly finding someone proficient in R that would be
> interested in doing the coding.
>
> I would like to preface my inquiry that while I am not a programmer I
> can communicate in a dialog my objectives.
>
> An array of rank ordered data looks like this:
> Item-Rank First Second Third Fourth Totals
> Item1 6 8 0 0 14
> Item2 7 5 2 0 14
> Item3 1 1 11 1 14
> Item4 0 0 1 13 14
> Totals 14 14 14 14
>
> The required output of R will be two fold;
>
> 1, a numerical score for each of the Items (1-4) from highest to
> lowest and lowest to highest on a scale of 0-99 that is statistically
> accurate. For this example the scores would be Item1 highest number
> down to Item4 with the lowest number. In reverse Item4 would be the
> highest number down to Item1 the lowest number. For the Highest like
> this; Item1=94, Item2=88, Item3=48, Item4=2 (just guessing here on the
> scores...:)
>
> 2, a graphical output of the data based on the scores in three special
> graphs with a middle line at '0' and increasing numbers to the left
> AND right. The graphs plot the Highest ranked Items, the Lowest Ranked
> items and a combination of the two.
> Sample graphs are here: http://community.abeo.us/sample-graphs/
>
> Looking forward to hearing if R will be able to accomplish this.

Hi Eric,
I would use mean ranks for something like this. You would have to 
calculate these from your summary array unless you have the raw ranks.

ranksumm2meanranks<-function(x,nobs) {
  nitems<-dim(x)[1] - 1
  meanrankvec<-rep(0,nitems)
  for(rankrow in 1:nitems) {
   for(rankcol in 1:nitems)
    meanrankvec[rankrow]<-
     meanrankvec[rankrow]+x[rankrow,rankcol]*rankcol
   meanrankvec[rankrow]<-
    meanrankvec[rankrow]/x[rankrow,nitems+1]
  }
  names(meanrankvec)<-rownames(x)[-1]
  return(meanrankvec)
}

 > ranksumm2meanranks(x)
    Item2    Item3    Item4   Totals
1.571429 1.642857 2.857143 3.928571

You can obtain the "reversed" ranks by subtracting the above from the 
maximum rank score (4), but I don't see why you would want to do this.

Your explanation of the plot is not entirely clear. The ranges of the 
ranks for the items are:

Item1 c(1,2)
Item2 c(1,3)
Item3 c(1,4)
Item4 c(3,4)

You could plot these as horizontal bars spanning the range of the ranks 
for each item with a vertical line across each bar showing the value of 
the mean rank for that item. This would illustrate both the relative 
position and variability of ranks, something like a boxplot.

In case you have incomplete ranks, check the crank package for 
completion of incomplete ranks.

Jim




More information about the R-help mailing list