ggplot2: Quick Heatmap Plotting, reshape?

Go To StackoverFlow.com

6

I'm trying to reproduce the heatmap presented on this blog by following their tutorial, but when I try to run their Jan 2010-code I get an error when asking for,

nba.m <- ddply(nba.m, .(variable), transform, rescale = rescale(value))
     Error in eval(expr, envir, enclos) : could not find function "rescale"

Reproducible code is available on the blog mentioned above

I'm using ggplot2_0.9.0 and R 2.14.2. Also, I did read this thread here on stackoverflow.com.

Any ideas to what might be wrong?

2012-04-04 06:59
by Eric Fail
I've run into a few similar problems, and I've often been able to fix them by explicitly loading library(scales) - Marius 2012-04-04 07:02
@Marius, thanks. That solved the problem, strange. Well, thanks - Eric Fail 2012-04-04 07:04
package 'scales' is not automaticaly loaded by ggplot2 since version 0.9 - broussea 2012-04-04 08:11
@Marius, could you add your comment as an answer? In that way Eric can point to your answer as the correct one, and we can vote on it, get's you some rep :) - Paul Hiemstra 2012-04-04 08:20


19

ggplot2 doesn't seem to be loading the scales library automatically anymore, so to use the rescale function, you have to explicitly load library(scales).

When you get an error about a function not being found, the ?? command can help you find which package the function might be in, e.g. ??rescale.

2012-04-04 08:35
by Marius
Ads