I am trying to reproduce this stackexchange question: Color countries on world map based on ISO3 codes in R using ggplot()
Below is how far I've gotten without an error. The last step, the sptransform step, I am getting the error below. If anyone could help that would be great. I'm also interested in what is the crucial thing that has changed from the original post. I changed a few things in my code below because I couldn't find the zip file on the internet anymore, so I don't really know at what point my code deviates from the original post.
library(maptools)
library(mapproj)
library(rgeos)
library(rgdal)
library(ggplot2)
library(jsonlite)
library(RCurl)
library(geojsonio)
data_url <- "https://github.com/nvkelso/natural-earth-vector/raw/master/geojson/ne_50m_admin_0_countries.geojson"
data_file <- "ne_50m_admin_0_countries.geojson"
download.file(data_url, data_file)
world <- geojson_read(data_file, what = "sp")
as.data.frame(SPDF)# remove antarctica
world <- world[!world$iso_a3 %in% c("ATA"),]
world <- spTransform(world, CRS("+proj=wintri"))
Error in input[[i]] : subscript out of bounds