【问题标题】:Error ggplotly: VECTOR_ELT() can only be applied to a 'list', not a 'NULL'错误 ggplotly:VECTOR_ELT() 只能应用于“列表”,而不是“NULL”
【发布时间】:2017-03-19 10:48:12
【问题描述】:

我正在使用 R 3.3.3 和 RStudio 1.0.136,以及所有软件包的最新版本。

plotly 包出现此错误

> ggiris <- qplot(Petal.Width, Sepal.Length, data = iris, color = Species)
> ggplotly(ggiris)
Error in grid.Call(L_convert, x, as.integer(whatfrom), as.integer(whatto),  : 
  VECTOR_ELT() can only be applied to a 'list', not a 'NULL'

在我“打印” ggplot 后,此错误不再发生:

> ggiris
> ggplotly(ggiris)

它不仅出现在 RStudio 中,还出现在 Shiny 应用中。

有什么提示吗?

注意:这更可能发生在“新”会话(刚打开 RStudio 之后)。

> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=French_Belgium.1252  LC_CTYPE=French_Belgium.1252   
[3] LC_MONETARY=French_Belgium.1252 LC_NUMERIC=C                   
[5] LC_TIME=French_Belgium.1252    

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

other attached packages:
[1] plotly_4.5.6  ggplot2_2.2.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.9       tidyr_0.6.1       viridisLite_0.1.3 digest_0.6.12    
 [5] dplyr_0.5.0       assertthat_0.1    grid_3.3.3        plyr_1.8.4       
 [9] R6_2.2.0          jsonlite_1.3      gtable_0.2.0      DBI_0.6          
[13] magrittr_1.5      scales_0.4.1      httr_1.2.1        lazyeval_0.2.0   
[17] labeling_0.3      tools_3.3.3       htmlwidgets_0.8   purrr_0.2.2      
[21] munsell_0.4.3     yaml_2.1.14       base64enc_0.1-3   colorspace_1.3-2 
[25] htmltools_0.3.5   tibble_1.2       

【问题讨论】:

  • 无法复制:R version 3.3.2 Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows &gt;= 8 x64 (build 9200) ... other ... : [1] plotly_4.5.6 ggplot2_2.2.1 loaded ... : [1] Rcpp_0.12.9 tidyr_0.6.1 viridisLite_0.1.3 digest_0.6.12 dplyr_0.5.0 assertthat_0.1 grid_3.3.2 plyr_1.8.4 R6_2.2.0 jsonlite_1.2 gtable_0.2.0 DBI_0.5-1 magrittr_1.5 scales_0.4.1 httr_1.2.1 lazyeval_0.2.0 labeling_0.3 tools_3.3.2 htmlwidgets_0.8 purrr_0.2.2 munsell_0.4.3 yaml_2.1.14 base64enc_0.1-3 colorspace_1.3-2 htmltools_0.3.5 tibble_1.2
  • 感谢您测试@apom。我也是,在3.3.2上我从来没有遇到过这个问题。
  • 也无法重现它,R 3.3.2 和 R 3.3.3 在 Windows 10 上使用 RStudio 1.0.136
  • 这也发生在我身上。 RStudio 1.0.136, R 3.3.3, Windows 7 x64, ggplot2_2.2.1 似乎很随机。我重新启动会话以摆脱它。我只使用ggplot2。所以,这可能不是一个 ggplotly 问题。
  • 谢谢@rmf,我现在感觉不那么孤单了。正如你所说,很随机。

标签: r ggplot2 plotly


【解决方案1】:

当我更改与我正在构建的包中的 ggplotly 对象关联的特征时,我遇到了同样的错误。短期修复是退出并重新启动会话,如上面的评论中所述。

【讨论】:

    【解决方案2】:

    我刚刚在我的电脑上遇到了同样的错误,同样的上下文。我只是从 RStudio 界面更新包,然后我得到错误。您可能需要更新您的 R 版本,它对我有用。

    希望对你有帮助!

    【讨论】:

    • 这个错误“随机”发生在我身上。我有所有最新版本的软件包和 R。
    • 您找到解决方案了吗@StéphaneLaurent?我在每个工作日运行的脚本上都有相同的错误,并且该错误大约每月发生一次。在预定的脚本上,我无法重新启动 R/Rstudio 或其他快速修复。非常感谢任何提示,...
    猜你喜欢
    • 1970-01-01
    • 2016-02-26
    • 1970-01-01
    • 2015-11-05
    • 2021-08-25
    • 1970-01-01
    • 1970-01-01
    • 2011-11-25
    • 1970-01-01
    相关资源
    最近更新 更多