Reputation: 51
I have made a map using the cited packages and code. However, I would like to add names or country codes on top of each country like in picture two. Is this possible?
library(sf)
library(tmap)
library(tmaptools)
library(leaflet)
library(dplyr)
library(tidyverse)
options(scipen = 999)
data <- read_excel("Datakart.xlsx")
EU <- st_read("NUTS_RG_20M_2021_3035.shp", stringsAsFactors = FALSE)
EU_and_data <- inner_join(EU, data)
euro <- c(2377294, 1313597, 7453440, 5628510)
tm_shape(EU_and_data, bbox = euro) +
tm_polygons("2015-2019", id = "CNTR_ID", palette = "Blues", style = "cont")
Data:
structure(list(NUTS_ID = c("AT", "DK", "FI", "FR", "LU", "DE"
), `2010-2014` = c(0.3635, 0.9272, 0.5081, 0.8051, 0.8051, 0.78
), ...3 = c("***", "**", "***", "***", "***", "***"), `2015-2019` = c(0.6019,
0.8196, 0.2917, 0.757, 0.757, 0.849), ...5 = c("***", "***",
"*", "***", "***", "***"), STUSPS = c("NY", "NJ", "PA", "FL",
"GA", "NC"), `2010 - 2014` = c(0.2941, 0.3832, 0.2895, 0.2835,
0.3128, 0.2557), ...8 = c("***", "***", "***", "***", "***",
"***"), `2015 - 2019` = c(0.1821, 0.2473, 0.24, 0.313, 0.4137,
0.366), ...10 = c("***", "***", "***", "***", "***", "***")), row.names = c(NA,
-6L), class = c("tbl_df", "tbl", "data.frame"))
Upvotes: 0
Views: 42