1

After I installed the R 4.0.0, I cannot display the mapview output in the viewer of RStudio. It would be great if someone can give me some hints to solve this.

Here is an example code.

library(mapview)

mapview(breweries)

And here is a screenshot of my RStudio Viewer. There is no error message, but the viewer is just blank.

enter image description here

Here is my session information, and I am using RStudio Version 1.1.442.

sessionInfo()
# R version 4.0.0 (2020-04-24)
# 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    LC_MONETARY=English_United States.1252
# [4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    
# 
# attached base packages:  
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] mapview_2.7.8
# 
# loaded via a namespace (and not attached):
#  [1] Rcpp_1.0.4.6            RColorBrewer_1.1-2      compiler_4.0.0          base64enc_0.1-3         class_7.3-17           
#  [6] tools_4.0.0             digest_0.6.25           uuid_0.1-4              jsonlite_1.6.1          satellite_1.0.2        
# [11] lifecycle_0.2.0         lattice_0.20-41         viridisLite_0.3.0       png_0.1-7               rlang_0.4.6            
# [16] DBI_1.1.0               crosstalk_1.1.0.1       yaml_2.2.1              e1071_1.7-3             raster_3.1-5           
# [21] leaflet.providers_1.9.0 gdtools_0.2.2           htmlwidgets_1.5.1       systemfonts_0.2.3       stats4_4.0.0           
# [26] classInt_0.4-3          leaflet_2.0.3           grid_4.0.0              webshot_0.5.2           svglite_1.2.3          
# [31] sf_0.9-3                R6_2.4.1                sp_1.4-2                leafpop_0.0.5           magrittr_1.5           
# [36] scales_1.1.1            codetools_0.2-16        htmltools_0.4.0         units_0.6-6             colorspace_1.4-1       
# [41] brew_1.0-6              KernSmooth_2.23-17      munsell_0.5.0           leafem_0.1.1
3
  • can you view anything in the viewer, such as a ggplot() graph?
    – PleaseHelp
    Commented Jun 11, 2020 at 20:25
  • @PleaseHelp Yes, I can. ggplot and base plot both works. For example, if I do plot(sf::st_geometry(breweries)), this gives me a point map.
    – www
    Commented Jun 11, 2020 at 20:27
  • 1
    You might want to upgrade your RStudio version -- the most recent release is 1.3 and running your code displays the map fine for me.
    – mfherman
    Commented Jun 11, 2020 at 21:49

2 Answers 2

4

This seems to be an issue of some combinations of RStudio, R and leaflet versions on Windows, see these GitHub issues:

Try to upgrade your RStudio, maybe it'll help (at least they say it's fixed for RStudio v1.3.957-1).

3

Solution to problem:

I have just installed R Version 4.4.0 and upgraded Rstudio to v 2024.04.0 build 735. I was suddenly unable to use MapView with the same symptoms as described above. The Viewer pane just came up blank. This was also true for trying to display the widget produced by ggplotly in the plotly package.

Just by fluke I discovered by putting the command

options(viewer = NULL)

before the mapview command solved the issue.

For the example above, try:

library(mapview)
options(viewer = NULL)
mapview(breweries)

enter image description here

1
  • hey, thanks, this came handy this morning (options(viewer = NULL) )
    – Zoltan
    Commented May 13 at 15:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.