jbkunst / highcharter

R wrapper for highcharts
http://jkunst.com/highcharter/
Other
720 stars 148 forks source link

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

Closed boxuancui closed 2 years ago

boxuancui commented 5 years ago

This is probably related to #420 . However, I tried everything on that issue, and I am still getting this failure.

To re-produce, simply run the example from ?hcaes_string:

> hchart(mtcars, "point", hcaes_string("hp", "mpg", group = "cyl"))
Error in mutate_impl(.data, dots) : 
  Column `group` is of unsupported type quoted call

Note: I have to use hcaes_string instead of hcaes.

boxuancui commented 5 years ago

After some investigation, I found that whenever package forecast is loaded, this can be re-produced.

Before loading forecast, everything works fine:

> library(highcharter)
Highcharts (www.highcharts.com) is a Highsoft software product which is
not free for commercial and Governmental use
> hchart(mtcars, "point", hcaes_string("hp", "mpg", group = "cyl"))
> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

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

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

other attached packages:
[1] highcharter_0.6.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18      pillar_1.3.0      compiler_3.5.1    bindr_0.1.1       tools_3.5.1       xts_0.11-1       
 [7] digest_0.6.17     jsonlite_1.5      lubridate_1.7.4   tibble_1.4.2      nlme_3.1-137      lattice_0.20-35  
[13] pkgconfig_2.0.2   rlang_0.2.2       igraph_1.2.2      rstudioapi_0.7    curl_3.2          yaml_2.2.0       
[19] bindrcpp_0.2.2    dplyr_0.7.6       stringr_1.3.1     htmlwidgets_1.2   grid_3.5.1        tidyselect_0.2.4 
[25] glue_1.3.0        data.table_1.11.6 R6_2.2.2          whisker_0.3-2     tidyr_0.8.1       purrr_0.2.5      
[31] TTR_0.23-4        magrittr_1.5      backports_1.1.2   htmltools_0.3.6   rlist_0.4.6.1     assertthat_0.2.0 
[37] quantmod_0.4-13   stringi_1.2.4     broom_0.5.0       crayon_1.3.4      zoo_1.8-4        

After loading forecast, the error comes up:

> library(forecast)
This is forecast 8.4 
  Want to meet other forecasters? Join the International Institute of Forecasters:
  http://forecasters.org/
> hchart(mtcars, "point", hcaes_string("hp", "mpg", group = "cyl"))
Error in mutate_impl(.data, dots) : 
  Column `group` is of unsupported type quoted call
> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

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

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

other attached packages:
[1] bindrcpp_0.2.2    forecast_8.4      highcharter_0.6.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18      urca_1.3-0        plyr_1.8.4        pillar_1.3.0      compiler_3.5.1    bindr_0.1.1      
 [7] tseries_0.10-45   tools_3.5.1       xts_0.11-1        digest_0.6.17     gtable_0.2.0      jsonlite_1.5     
[13] lubridate_1.7.4   tibble_1.4.2      nlme_3.1-137      lattice_0.20-35   pkgconfig_2.0.2   rlang_0.2.2      
[19] igraph_1.2.2      rstudioapi_0.7    parallel_3.5.1    curl_3.2          yaml_2.2.0        dplyr_0.7.6      
[25] stringr_1.3.1     htmlwidgets_1.2   uroot_2.0-9       nnet_7.3-12       lmtest_0.9-36     grid_3.5.1       
[31] tidyselect_0.2.4  glue_1.3.0        data.table_1.11.6 R6_2.2.2          ggplot2_3.0.0     whisker_0.3-2    
[37] tidyr_0.8.1       purrr_0.2.5       TTR_0.23-4        magrittr_1.5      scales_1.0.0      backports_1.1.2  
[43] htmltools_0.3.6   rlist_0.4.6.1     assertthat_0.2.0  quantmod_0.4-13   timeDate_3043.102 colorspace_1.3-2 
[49] fracdiff_1.4-2    quadprog_1.5-5    stringi_1.2.4     lazyeval_0.2.1    munsell_0.5.0     broom_0.5.0      
[55] crayon_1.3.4      zoo_1.8-4        

I unloaded forecast package in the same session, and it didn't change the error:

> detach("package:forecast", unload=TRUE)
> hchart(mtcars, "point", hcaes_string("hp", "mpg", group = "cyl"))
Error in mutate_impl(.data, dots) : 
  Column `group` is of unsupported type quoted call
pwildenhain commented 5 years ago

I was also having this issue, and it seems like it was the loading of ggplot2 to blame, specifically any version greater that 2.2.0, but less than 3.0.0. If you look at the different packages that get loaded along with forecast, you'll see that ggplot2 is one of them.

I tried re-installing ggplot2 and that worked for me; install.packages("ggplot2")

However, this could potentially introduce other reverse compatibility issues, and is definitely not a long term fix. I'm still confused as to why ggplot2 would cause this higcharter bug, when highcharter doesn't import anything from ggplot2. There must be some common source between these packages that is causing the underlying issue.

EDIT: The two packages that both ggplot2 and highcharter import are rlang and tibble. My guess would be that rlang is to blame. The most recent version of ggplot2 installs a higher version of rlang (0.2.1) than highcharter does (0.1.1).

batpigandme commented 5 years ago

So it looks like hcaes_string() has been deprecated, but this _does- now work with latest ggplot2 and rlang if you quote the params (the image doesn't fully load when you run it through reprex, but if you run the code live, you'll see it comes out fine):

suppressPackageStartupMessages(library(tidyverse))
library(highcharter)
#> Highcharts (www.highcharts.com) is a Highsoft software product which is
#> not free for commercial and Governmental use
hchart(mtcars, "point", hcaes("hp", "mpg", group = "cyl"))

Created on 2019-01-09 by the reprex package (v0.2.1.9000)

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Feel free to reopen it if you find it necessary.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Feel free to reopen it if you find it necessary.