Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ggplot2: Quick Heatmap Plotting, reshape?

Tags:

r

ggplot2

heatmap

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?

like image 335
Eric Fail Avatar asked Apr 04 '12 06:04

Eric Fail


1 Answers

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.

like image 128
Marius Avatar answered Oct 15 '22 17:10

Marius