[R] Plot NUTS regions with color

Phillips Rogfield thebudget72 @end|ng |rom gm@||@com
Wed Jun 23 19:35:50 CEST 2021


Dear R-help ML,

I have downloaded the NUTS shapefiles from here: 
https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts

I can load them with the following code:

    library(rgdal)
    shp_bdir <- [PATH TO SHAPE FILE]
    layername <- "NUTS_RG_01M_2021_4326"
    shp_folder <- file.path(shp_bdir, paste0(layername,".shp"))
    EU_NUTS <- readOGR(dsn = shp_folder, layer = layername)

Then I can plot the regions with:

    plot(EU_NUTS)

Now I have a list of NUTS - 3 Level, for example:

    l <- c("AT223", "AT212", "AT212", "AT121")

I would like a plot where the NUTS regions are colored, and the more a 
particular NUTS is present is the list, the darker its color.

For example "AT212" should be darker than "AT223", because the former is 
present two times in the list.

How can I achieve that?

Thank you and best regards.


	[[alternative HTML version deleted]]



More information about the R-help mailing list