I want to project this map in robinson projection:
library(ggmap)
world <- map_data("world")
ggplot() + geom_path(data = world,
aes(long, lat, group = group))
And I would like to change the projection to "Robinson" (following advice from answer to my previous question: What projection does the global climate region map from Wikipedia use?
I had a hard time finding a default implementation of this projection, I worked out the following for using the proj4
library:
library(proj4)
robinson <- project(cbind(world$long, world$lat),
proj = "+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs")
I have tried a number of approaches, including:
# using ggmap::get.map()
get_map("world", projection = mapprojection(robinson))
# using ggplot2::coord_map
coord_map(projection = robinson)
# and sp::coordinates:
library(sp)
coordinates(world) <- ~ lat + long
gridded(world) <- TRUE # returns error
proj4string(world) <- CRS(robinson)
but none of these work. Is it a typo, or I missing something fundamental about this method?