问题
I updated my computer the other day (R, R Tools, and RStudio), and leaflet stopped working.
When I run this example in the RGUI it's very slow, but eventually it opens a web page in a browser.
When I run it in R Studio it's very slow, eventually the command finishes but nothing appears in the "view" tab, and R Studio keeps using more and more memory until I force kill it.
library(leaflet)
leaflet() %>% addTiles() %>% addMarkers(lng=174.768, lat=-36.852, popup="R")
I've tried a few things with my path, and installing leaflet from github, but there's not much to troubleshoot.
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 15063)
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] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.0 tools_4.0.0
Edit 2020-05-09:
I reverted to R 3.6.2 and am no longer having the issue. Fortunately I could change it in R Studio's options so I can switch back to 4.0 if that becomes necessary.
I'm not adding this as an answer because it's a work around.
来源:https://stackoverflow.com/questions/61549557/leaflet-maps-not-working-in-r-studio-after-r-4-0-0-upgrade