2010-08-19 83 views
2

我最近安裝了最新版本ggplot的,通過下載從CRAN源,然後運行R + ggplot:更新問題geom_tile

install.packages("/path/to/ggplot2_0.8.8.tar.gz", repos = NULL, type="source") 

現在,運行從geom_tile第一個例子中()的在GGPLOT2網站上的文檔:

library('ggplot2') 
pp <- function (n,r=4) { 
    x <- seq(-r*pi, r*pi, len=n) 
    df <- expand.grid(x=x, y=x) 
    df$r <- sqrt(df$x^2 + df$y^2) 
    df$z <- cos(df$r^2)*exp(-df$r/6) 
    df 
} 
p <- ggplot(pp(20), aes(x=x,y=y)) 
p + geom_tile(aes(fill=z)) 

提供了以下錯誤:

Error in get("make_aesthetics", env = x, inherits = TRUE)(x, ...) : 
    could not find function "empty" 

任何人有任何想法?

> sessionInfo() 
R version 2.10.1 Patched (2010-01-25 r51042) 
x86_64-apple-darwin9.8.0 

locale: 
[1] en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8 

attached base packages: 
[1] grid  stats  graphics grDevices utils  datasets methods 
[8] base  

other attached packages: 
[1] ggplot2_0.8.8 proto_0.3-8 reshape_0.8.3 plyr_0.1.9 

回答

2

您還需要更新plyr包。

other attached packages: 
[1] ggplot2_0.8.8 proto_0.3-8 reshape_0.8.3 plyr_1.1 
+0

太棒了。有什麼辦法可以自己發現嗎? – 2010-08-19 14:57:17

+1

那麼,你可以用'dependencies = TRUE'選項運行'install.packages()'... – Harlan 2010-08-19 16:58:37