jeff
jeff

Reputation: 13683

R cannot find the function get_map

I'm trying to make a google map with R, with this r_google_maps.r script:

require(ggmap)

mapImageData1 <- get_map(location = c(lon = -0.016179, lat = 51.538525),
    color = "color",
    source = "google",
    maptype = "satellite",
    zoom = 17)

ggmap(mapImageData1,
    extent = "device",
    ylab = "Latitude",
    xlab = "Longitude")

and I call source("r_google_maps.r"); in the command window,

I get this error :

Error in eval(expr, envir, enclos) : could not find function "get_map"

How do I solve this problem?

Thanks !

Edit:

I'm on windows 7 64-bit

Upvotes: 0

Views: 5626

Answers (1)

spatton
spatton

Reputation: 41

I do not know what platform you are on, but for me to get 'ggmap' properly installed on Linux, I had to install the OS package libpng-devel, THEN upgrade the 'maps' R package by reinstalling.

Then mapproj and ggmap installed without further errors, and I successfully saw the map you were loading in my RStudio window.

Perhaps you can check any error messages that might have gone by when you tried to install ggmap for any clues that are particular to your platform and environment.

Upvotes: 1

Related Questions