错误ggplotly:VECTOR_ELT()只能应用于'列表',而不是'NULL' [英] Error ggplotly: VECTOR_ELT() can only be applied to a 'list', not a 'NULL'

查看:2842
本文介绍了错误ggplotly:VECTOR_ELT()只能应用于'列表',而不是'NULL'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 R 3.3.3 和RStudio 1.0.136 ,并且所有的最新版本。

包装中出现此错误

 > ggiris <-qplot(Petal.Width,Sepal.Length,data = iris,color = Species)
> ggplotly(ggiris)
grid.Call中的错误(L_convert,x,as.integer(whatfrom),as.integer(whatto),:
VECTOR_ELT()只能应用于'list',不是'NULL'

在我打印ggplot后,这个错误不再发生:

 > ggiris 
> ggplotly(ggiris)

它不仅发生在RStudio中,还发生在Shiny应用程序中。



任何提示?


$ b

注意:这很可能发生在新鲜会话中(仅在打开RStudio之后)。

 > sessionInfo()
R版本3.3.3(2017-03-06)
平台:x86_64-w64-mingw32 / x64(64位)
运行于:Windows 7 x64(内部版本7601)Service Pack 1

区域设置:
[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

附加的基础包装es:
[1] stats graphics grDevices utils datasets methods base

其他附加软件包:
[1] plotly_4.5.6 ggplot2_2.2.1

已加载通过命名空间(并未附加):
[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] labels_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


解决方案

当我更改包中的ggplotly对象的相关特性时, 。短期修复是退出并重新启动会话,如上面的评论中所述。


I'm using R 3.3.3 and RStudio 1.0.136, and the latest versions of all the packages.

I get this error with the plotly package

> 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'

This error does not occur anymore after I "print" the ggplot:

> ggiris
> ggplotly(ggiris)

It occurs not only in RStudio, but also in a Shiny app.

Any hint ?

Note: This more likely occurs with a "fresh" session (just after opening 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       

解决方案

I am getting the same error when I change characteristics associated with a ggplotly object within a package I am building. Short term fix is to quit and restart the session, as mentioned in a comment above.

这篇关于错误ggplotly:VECTOR_ELT()只能应用于'列表',而不是'NULL'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆