I am trying to make a map using ggmap pulling the image from google. Below is my code where I am trying to pull a plot of Utah and then plot it.
The plot will not be made because of the error that I receive: "error in as.vector(y) : attempt to apply non-function."
Any clue on what is going on and why it won't work?
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
Edit: 11/14/2016 4:00 pm
I updated R, Rstudio, and ggplot2. Now I receive this error message when I try to load 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’
I tried to install Rcpp and I receive this message:
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
Now I can't run anything related to ggplot or anything. My new R details are:
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)