ggmap 的 get_map returns 'Error in gzfile(file, "rb") : cannot open the connection'

ggmap's get_map returns 'Error in gzfile(file, "rb") : cannot open the connection'

我有一些 R 代码可以使用 ggmap 在地图上绘制数据。上周工作正常。但是,现在当我 运行 获取地图的行时:

emap <- get_map(c(-2.503704,43.18735),zoom=9,maptype="roadmap",color="bw")  

我收到以下错误:

Error in gzfile(file, "rb") : cannot open the connection
In addition: Warning message:
In gzfile(file, "rb") :
  cannot open compressed file '/var/folders/2w/2wSOAL2LFUC+2QkRaR1wI++++TI/-Tmp-//Rtmpj0TMx5/ggmap/index.rds', probable reason 'No such file or directory'

我搜索了这个论坛和网络,但找不到任何其他讨论此错误的话题。

非常感谢任何帮助。 问候, 诺莉亚

PS: sessionInfo() returns 如下:

R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

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] mapproj_1.2-2  maps_2.3-9     ggmap_2.4      dplyr_0.4.1        xtable_1.7-4   ggplot2_1.0.1  reshape2_1.4.1

loaded via a namespace (and not attached):
[1] assertthat_0.1      colorspace_1.2-6    DBI_0.3.1           digest_0.6.8        geosphere_1.3-13    grid_3.1.2         
[7] gtable_0.1.2        jpeg_0.1-8          labeling_0.3        lattice_0.20-31     lazyeval_0.1.10     magrittr_1.5       
[13] MASS_7.3-40         munsell_0.4.2       parallel_3.1.2      plyr_1.8.1          png_0.1-7           proto_0.3-10       
[19] Rcpp_0.11.5         RgoogleMaps_1.2.0.7 rjson_0.2.15        RJSONIO_1.3-0       scales_0.2.4        sp_1.0-17          
[25] stringr_0.6.2       tools_3.1.2  

我遇到过同样的错误,之前的代码也能正常工作。您可能已经尝试过这个,但我通过简单地结束 R 会话并重新启动它来解决它。

如果这不起作用,请尝试 uninstalling/reinstalling R(Studio),或者至少尝试相关的软件包。

如果您将文件保存为 RData,即使您可以在 R 中打开它,但有时它已损坏,您必须再次 运行 公式中的所有这些变量,然后您可以 运行 您的正确编码。这是因为在您的公式中有一个计算机无法访问的变量。

我也遇到了同样的问题。我使用 R 版本 3.4.2 和 RStudio 版本 1.1.383。我重新启动了 RStudio,它解决了这个问题。