I've got this csv table for which I need to rescale data between 0 and 1 per each column. That is, the lowest value of any given column will be 0, the highest will be 1, and all other values will be linearly scaled accordingly. Here's my script:
tableau <- read.csv("/tableau.csv")
tableau.m <- melt(tableau)
tableau.m <- ddply(tableau.m, .(variable), transform,rescale = rescale(value))
(And here's the data: https://dl.dropboxusercontent.com/u/73950/tableau.csv)
The issue is that I need the second column ("B") to be inverted. That is, for this column only and not for the others, the lowest value should be 1, and the highest should be 0.
Is plyr flexible that way, or should I try other ways to achieve this?
(In this example, column B should read with 2.13 being white, 1.88 being dark blue, and 2.07's, 2.09's, 2.05's shades being scaled accordingly. The other column should be left untouched.)
ddply(tableau.m, .(variable), transform,rescale = rescale(-value))
(not tested) - akrun