zero_range() 当 运行 ggrepel 与 Github 版本的 ggplot2 时出错

Error in zero_range() when running ggrepel with Github version of ggplot2

我最近将我的 R 版本升级到 3.2.3,并更新了我的软件包。然后我安装了 Github 版本的 ggplot2 和 CRAN 版本的 ggrepel.

正在使用的包的版本是:

ggplot2: 2.1.0.9000  
ggrepel: 0.5  
scales: 0.4.0

但是在加载这些包之后,我什至无法 运行 ggrepel 提供的示例脚本:

library(ggrepel)  
p <- ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars)))
# Avoid overlaps by repelling text labels
p + geom_text_repel() 

Error in zero_range(from) : x must be length 1 or 2

函数 zero_range() 来自 scales 包。然而,对我来说奇怪的是,如果我从 CRAN (version 2.1.0) 安装 ggplot2ggrepel 将按预期开始工作。
更新或重新安装 scalesggrepel 没有任何效果。

我记得在我的旧版本 R 3.1.3 中,我从 Github 安装了 ggplot2(以使用字幕),并且在那里运行良好。

我的会话信息是:

R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
[1] ggrepel_0.5        ggplot2_2.1.0.9000

loaded via a namespace (and not attached):
 [1] labeling_0.3     colorspace_1.2-6 scales_0.4.0     assertthat_0.1   lazyeval_0.2.0   plyr_1.8.4      
 [7] tools_3.2.3      gtable_0.2.0     tibble_1.2       Rcpp_0.12.7      grid_3.2.3       munsell_0.4.3

根据我的调试,错误发生在这个函数:

ggproto("LayerInstance", Layer, geom = geom, geom_params = geom_params, 
        stat = stat, stat_params = stat_params, data = data, 
        mapping = mapping, aes_params = aes_params, subset = subset, 
        position = position, inherit.aes = inherit.aes, show.legend = show.legend)

并在其中:

function (`_class` = NULL, `_inherit` = NULL, ...) 
{
    e <- new.env(parent = emptyenv())
    members <- list(...)
    if (length(members) != sum(nzchar(names(members)))) {
        stop("All members of a ggproto object must be named.")
    }
    if (length(members) > 0) {
        list2env(members, envir = e)
    }
    if (!is.null(`_inherit`)) {
        if (!is.ggproto(`_inherit`)) {
            stop("`_inherit` must be a ggproto object.")
        }
        e$super <- `_inherit`
        class(e) <- c(`_class`, class(`_inherit`))  ###### Here layeth the error, as I think
    }
    else {
        class(e) <- c(`_class`, "ggproto")
    }
    e
}

但我对解决方案一无所知。

使用 ggrepel 的最新开发版本,错误消失了。

使用 devtools::install_github("slowkow/ggrepel@0.6.2")

安装

包版本:

ggplot2    * 2.1.0.9001 2016-10-07 Github (hadley/ggplot2@979004a)
ggrepel    * 0.6.2      2016-10-07 Github (slowkow/ggrepel@254bd61)
scales       0.4.0.9003 2016-10-07 Github (hadley/scales@d58d83a)