Mara, I'm having exactly the same error pattern as stote did, but unfortunately no amount of re-installing, re-loading, or re-starting the session altogether is resolving it. My code was working beautifully yesterday, and then when I went to re-run today, I get the errors. So it must be an order or packages issue? SO grateful if you can help.
centroids <- read_delim("C:/Users/ch111111/Dropbox /Folder/centroids.csv", delim = "\t")%>%
mutate(country.code = countrycode(SHORT_NAME, "country.name","iso3c", warn = T))%>%
select(lat = "LAT", long = "LONG", country.code)
centroids[, c("lat", "long")] <- project(xy = as.matrix(centroids[, c("long", "lat")]), proj = "+proj=robin")
absolute_GDP <- read_excel(path, sheet = "Cumulative GDP lost (13)") %>%
rename(country = Country, cum_GDP = Cumulative GDP Lost
) %>%
mutate(iso = countrycode(country, "country.name", "iso3c")) %>%
mutate(cum_GDP = cum_GDP / 10^9)
centroids <- left_join(centroids, absolute_GDP, by = c("country.code" = "iso")) %>%
filter(!is.na(cum_GDP))
ggplot() +
geom_sf(data = world, show.legend = F) +
geom_point(data = centroids, aes(x = lat, y = long, size = cum_GDP)) +
scale_size_area(max_size = 25, breaks = c(0.1, 1, 50, floor(max(centroids$cum_GDP)))) +
theme_bw()