mutate_impl(.data,点)中的hchart错误:列“ x”的类型不带引号的调用

时间:2018-07-11 20:40:16

标签: r highcharts compiler-errors

我有以下数据

> temp_data %>% head(15) %>% select(title,voteCount)
# A tibble: 15 x 2
                                                                            title voteCount
                                                                           <fctr>     <int>
 1                                                            Forrest Gump (1994)     91921
 2                                               Shawshank Redemption, The (1994)     91082
 3                                                            Pulp Fiction (1994)     87901
 4                                               Silence of the Lambs, The (1991)     84078
 5                                                             Matrix, The (1999)     77960
 6                                      Star Wars: Episode IV - A New Hope (1977)     77045
 7                                                           Jurassic Park (1993)     74355
 8                                                        Schindler's List (1993)     67662
 9                                                              Braveheart (1995)     66512
10                                                               Toy Story (1995)     66008
11                              Star Wars: Episode VI - Return of the Jedi (1983)     62714
12                                              Terminator 2: Judgment Day (1991)     61836
13                          Star Wars: Episode V - The Empire Strikes Back (1980)     61672
14                                                              Fight Club (1999)     60024
15 Raiders of the Lost Ark (Indiana Jones and the Raiders of the Lost Ark) (1981)     59693

我想使用此行代码使用hchart创建条形图

hchart(head(temp_data,15), hcaes(x=title, y=voteCount), type="column") %>% hc_add_theme(hc_theme_google())

它以前工作过,但是后来我更新了RStudio中的某些软件包,此后,每当我尝试运行此行时,都会出现错误:

Error in mutate_impl(.data, dots) : Column `x` is of unsupported type quoted call

我不知道是哪个更新引起的,也找不到它,我尝试搜索问题并找到了this thread,但是找不到任何可以解决我问题的东西。

这是我的会话信息:

> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

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

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

other attached packages:
 [1] bindrcpp_0.2        arulesViz_1.3-1     wordcloud2_0.2.0    arules_1.6-1       
 [5] Matrix_1.2-11       tidytext_0.1.8      tm_0.7-3            NLP_0.1-11         
 [9] stringi_1.1.7       stringr_1.3.0       magrittr_1.5        data.table_1.10.4-3
[13] plotly_4.7.1        tidyr_0.8.1         ggplot2_3.0.0       highcharter_0.5.0  
[17] dplyr_0.7.4         readr_1.1.1        

loaded via a namespace (and not attached):
 [1] nlme_3.1-131         bitops_1.0-6         xts_0.10-1           lubridate_1.7.2     
 [5] httr_1.3.1           prabclus_2.2-6       SnowballC_0.5.1      tools_3.4.2         
 [9] DT_0.4               R6_2.2.2             KernSmooth_2.23-15   lazyeval_0.2.1      
[13] colorspace_1.3-2     trimcluster_0.1-2    nnet_7.3-12          withr_2.1.2         
[17] gridExtra_2.3        mnormt_1.5-5         curl_3.0             compiler_3.4.2      
[21] TSP_1.1-6            xml2_1.2.0           labeling_0.3         slam_0.1-42         
[25] diptest_0.75-7       caTools_1.17.1       scales_0.5.0         lmtest_0.9-36       
[29] DEoptimR_1.0-8       mvtnorm_1.0-7        psych_1.7.8          robustbase_0.93-0   
[33] digest_0.6.12        foreign_0.8-69       pkgconfig_2.0.1      htmltools_0.3.6     
[37] htmlwidgets_1.2      rlang_0.2.1          TTR_0.23-3           quantmod_0.4-12     
[41] visNetwork_2.0.4     bindr_0.1            zoo_1.8-1            jsonlite_1.5        
[45] mclust_5.4           gtools_3.5.0         dendextend_1.8.0     tokenizers_0.2.1    
[49] rlist_0.4.6.1        modeltools_0.2-21    Rcpp_0.12.15         munsell_0.4.3       
[53] viridis_0.5.1        scatterplot3d_0.3-41 whisker_0.3-2        yaml_2.1.14         
[57] MASS_7.3-47          flexmix_2.3-14       gplots_3.0.1         plyr_1.8.4          
[61] parallel_3.4.2       gdata_2.18.0         lattice_0.20-35      hms_0.4.1           
[65] knitr_1.17           pillar_1.2.3         igraph_1.2.1         fpc_2.1-11          
[69] reshape2_1.4.2       codetools_0.2-15     stats4_3.4.2         glue_1.2.0          
[73] gclus_1.3.1          vcd_1.4-4            foreach_1.4.4        gtable_0.2.0        
[77] purrr_0.2.5          kernlab_0.9-25       assertthat_0.2.0     broom_0.4.2         
[81] janeaustenr_0.1.5    class_7.3-14         viridisLite_0.3.0    seriation_1.2-3     
[85] tibble_1.4.2         iterators_1.0.9      registry_0.5         cluster_2.0.6   

有什么办法解决这个问题吗?

2 个答案:

答案 0 :(得分:2)

我有同样的问题。安装了开发版本0.6.0。现在可以正常工作了。

或按如下所示修改您的代码,它应该可以工作。

temp_data <- head(temp_data)

highchart() %>% 
hc_chart(type = "column") %>% 
hc_xAxis(categories = temp_data$title) %>% 
hc_add_series(data = temp_data$voteCount,
name = "temp data",colorByPoint = TRUE)%>% 
hc_add_theme(hc_theme_google())

答案 1 :(得分:0)

我有与上述类似的问题。系统提示我更新一些软件包依赖项。但是,我的Rcpp版本没有正确更新。我重新安装了软件包并加载了highcharter的开发版本。然后,我重新启动了r会话并运行了代码,瞧。奏效了!