Hi,
I have this code which has been working:
NPS.by.Region <- data.frame(
stringsAsFactors = FALSE,
Region = c("East Midlands",
"East of England","London","North East","North West",
"Northern Ireland","Scotland","South East","South West","Wales",
"West Midlands","Yorkshire and The Humber"),
AVER.NPS = c(80.3990610328639,
65.3417015341702,65.8536585365854,86.61800486618,72.6201269265639,
80,80.9663250366032,71.0091743119266,76.8518518518518,
79.4721407624633,75.2092050209205,76.1425959780622),
Count = c(852,1434,451,411,1103,135,
683,2180,972,341,956,1094)
)
NPS.by.Region
library(rgdal)
eng1 <- rgdal::readOGR(paste0("https://opendata.arcgis.com/datasets/",
"8d3a9e6e7bd445e2bdcc26cdf007eac7_4.geojson"))
countries1 <- rgdal::readOGR(paste0("https://opendata.arcgis.com/datasets/",
"92ebeaf3caa8458ea467ec164baeefa4_0.geojson"))
eng <- sf::st_as_sf(eng1)
countries <- sf::st_as_sf(countries1)
UK <- countries[-1,]
names(eng)[3] <- "Region"
names(UK)[3] <- "Region"
UK$objectid <- 10:12
eng <- eng[-2]
UK <- UK[c(1, 3, 9:11)]
UK <- rbind(eng, UK)
library(dplyr)
ukj <- left_join(UK,NPS.by.Region)
ggplot2::ggplot(ukj, ggplot2::aes(fill = AVER.NPS)) +
ggplot2::geom_sf() +
ggplot2::scale_fill_gradient(low="#CC0000", high = "#006600")
Now, there are some issues with rgdal or something else as I cannot run it anymore.
Can anyone help?