我正在嘗試使用ggmap從Google中拉出圖像來製作地圖。下面是我的代碼,我試圖拉猶他州的陰謀,然後繪製它。使用ggmap繪製R的問題
由於我收到的錯誤不會生成圖表:「as.vector(y)中的錯誤:嘗試應用非函數」。
關於發生了什麼以及爲什麼它不起作用的任何線索?
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
#pull map of Utah
Ut.map <- get_map(location=c(-111, 39.5), zoom=7, maptype="roadmap")
Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=39.5,-111&zoom=7&size=640x640&scale=2&maptype=roadmap&language=en-EN&sensor=false
ggmap(Ut.map)
Error in as.vector(y) : attempt to apply non-function
編輯:二〇一六年十一月一十四日下午4:00
我更新R,Rstudio和GGPLOT2。現在,當我嘗試加載GGPLOT2我收到此錯誤信息:
library(ggplot2)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘Rcpp’
Error: package or namespace load failed for ‘ggplot2’
我試圖安裝RCPP和我收到此消息:
install.packages("Rcpp")
Installing package into ‘C:/Users/justi/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
trying URL
'https://cran.rstudio.com/bin/windows/contrib/3.3/Rcpp_0.12.7.zip'
Content type 'application/zip' length 3265506 bytes (3.1 MB)
downloaded 3.1 MB
package ‘Rcpp’ successfully unpacked and MD5 sums checked
Warning in install.packages :
unable to move temporary installation ‘C:\Users\justi\Documents\R\win-
library\3.3\file150426f11cb7\Rcpp’ to ‘C:\Users\justi\Documents\R\win-
library\3.3\Rcpp’
The downloaded binary packages are in
C:\Users\justi\AppData\Local\Temp\RtmpesXik0\downloaded_packages
現在我不能跑ggplot相關的任何東西或任何。我的新R的詳細信息是:
R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
對我很好,重新啓動R – Mateusz1981
重新啓動不起作用。重新安裝使它變得更糟(參見上面的編輯) – Justin