[R] R suitability for development project

Jim Lemon jim at bitwrit.com.au
Tue Sep 4 11:31:03 CEST 2012


On 09/03/2012 11:18 PM, Eric Langley wrote:

<chomp>
>
> I note:
> Is it possible to have the output as an integer where 99 is the highest score?
>
It certainly is. The mean ranks are:

Item2    Item3    Item4   Totals
  1.571429 1.642857 2.857143 3.928571

To make the highest score 99 (meaning the score for the highest ranked 
item) and the lowest score -99 as on your examples:

# first convert high ranks to high numeric scores
revmeanranks<-4-meanranks
revmeanranks
    Item1    Item2    Item3    Item4
2.428571 2.357143 1.142857 0.071429
# scale the score to the desired range
library(plotrix)
rescale(revmeanranks,c(-99,99))
      Item1      Item2      Item3      Item4
  99.000000  93.000046  -9.000015 -99.000000
# then just round or truncate your values to get integers

<chomp>

> I note:
> The look I am aiming to achieve (as shown here:
> http://community.abeo.us/sample-graphs/ ) is a relative position
> within the middle zero based horizontal axis. The mean is not
> required. Since all bars are 14 units long the upper and lower values
> note where the end of each bar should align, either to the right for
> Highest or to the left for Lowest. The third graph shows both.
>
> ~eric
>
I think you may be doing something here that you don't intend. The point 
of plots like this is to transform numeric values into lengths or areas. 
If you don't maintain the same metric throughout the plot, the 
relationship between the two is lost. If you were using vertical lines 
to indicate the transformed mean ranks of the items, they could be 
placed at the appropriate positions. As you use different edges of the 
bars to place them, let's see, your bars are about 90 units wide so 
there would be about a 180 unit offset between positive and negative 
transformed mean ranks. Are you sure that you want to do this?

Jim




More information about the R-help mailing list