R session hangs up after using ggplotly()

41 views Asked by At

My R session (within RStudio) hangs up after using ggplotly().
For testing, I use one of the examples of ?ggplotly. The example normally works ok once or twice, but the R session hangs up after several tries (in the example below, the 2nd run hung up the session). I cannot even close the RStudio from the GUI and have to use the System Monitor application to kill it.
This problem arises when I run the following code after I have loaded a given project, not if I start a R session with no project. But the project does not load any data or package, so do not know how to identify the problem.
This is what I specifically do:

I have found that loading package TSclust is the problem:

require(ggplot2)
require(plotly)

    data(canada.cities, package = "maps")
    viz <- ggplot(canada.cities, aes(long, lat)) +
    borders(regions = "canada") +
    coord_equal() +
    geom_point(aes(text = name, size = pop), colour = "red", alpha = 1/2)
    ggplotly(viz, tooltip = c("text", "size"))
    #check that works
    #clear all Viewer panes with the button
    require(TSclust)
    ggplotly(viz, tooltip = c("text", "size"))
    #no View and R hangs up



> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Pop!_OS 22.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=es_ES.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=es_ES.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] TSclust_1.3.1 cluster_2.1.2 pdc_1.0.3     plotly_4.10.3 ggplot2_3.4.4

loaded via a namespace (and not attached):
 [1] rgl_1.2.1              Rcpp_1.0.11            lattice_0.20-45        tidyr_1.3.0            class_7.3-20           zoo_1.8-12             digest_0.6.33         
 [8] lmtest_0.9-40          utf8_1.2.3             R6_2.5.1               httr_1.4.7             pillar_1.9.0           rlang_1.1.1            lazyeval_0.2.2        
[15] curl_5.1.0             misc3d_0.9-1           rstudioapi_0.15.0      data.table_1.14.8      fracdiff_1.5-2         TTR_0.24.3             labeling_0.4.3        
[22] htmlwidgets_1.6.2      munsell_0.5.0          proxy_0.4-27           compiler_4.1.2         xfun_0.40              pkgconfig_2.0.3        base64enc_0.1-3       
[29] forecast_8.21.1        urca_1.3-3             htmltools_0.5.6.1      tcltk_4.1.2            nnet_7.3-17            tidyselect_1.2.0       tibble_3.2.1          
[36] quadprog_1.5-8         dtw_1.23-1             fansi_1.0.5            viridisLite_0.4.2      dplyr_1.1.3            withr_2.5.1            grid_4.1.2            
[43] nlme_3.1-155           jsonlite_1.8.7         gtable_0.3.4           lifecycle_1.0.3        magrittr_2.0.3         scales_1.2.1           KernSmooth_2.23-20    
[50] quantmod_0.4.25        cli_3.6.1              longitudinalData_2.4.5 tseries_0.10-54        timeDate_4022.108      ellipsis_0.3.2         xts_0.13.1            
[57] generics_0.1.3         vctrs_0.6.4            tools_4.1.2            glue_1.6.2             purrr_1.0.2            clv_0.3-2.4            maps_3.4.1.1          
[64] crosstalk_1.2.0        parallel_4.1.2         fastmap_1.1.1          yaml_2.3.7             colorspace_2.1-0       locpol_0.8.0           knitr_1.44 
0

There are 0 answers