Con estos paquetes:
library(readr)
library(leaflet)
library(magrittr)
library(ggmap)
library(ggrepel)
Me gustaría poder poner estos putos en un mapa con mayor relieve siguiendo este script
puntos <- data.frame(lon=c(-3.391830, -3.530613, -3.205903, -3.137145, -3.500323,-3.536191, -3.196057, -3.131139, -3.345220, -3.476462, -3.125794, -3.252617, -3.345220, -3.503040, -3.125000, -3.182801, -3.476076, -3.131000, -3.593308, -3.599064, -3.477574, -3.214026, -3.253943),
lat=c(39.595520, 40.225155, 40.320294, 40.345348, 40.059138, 40.234966, 40.089637, 40.494167, 40.03184, 40.048758, 40.050352, 40.245459, 40.03184, 40.050578, 40.0459, 40.032298, 40.050052, 40.04472, 40.051302, 40.043193, 40.04933, 40.085899, 40.245852),
nom=c('Q1', 'Q2', 'Q3', 'Q4','E1', 'E2', 'E3', 'E4',
'L1', 'L2', 'L3', 'L4','M1', 'M2', 'M3', 'M4',
'Z1', 'Z2','C1', 'C2', 'H1', 'H2', 'H3'),
habitat=c('Oak', 'Oak', 'Oak', 'Oak','Wasteland', 'Wasteland', 'Wasteland', 'Wasteland',
'Edge', 'Edge', 'Edge', 'Edge','Crop', 'Crop', 'Crop', 'Crop',
'Crop', 'Crop','Crop', 'Crop', 'Crop', 'Crop', 'Crop'))
puntos<-as.data.frame(puntos)
map.unizar <- get_map( location = c(-3.4, 40.1),
color = "color",
maptype = "terrain",
scale = 2,
zoom = 9)
ggmap(map.unizar) + geom_point(aes(color=habitat),
data = puntos,
size = 2)
+scale_x_continuous("longitude")+scale_y_continuous("latitude")+
geom_text_repel(aes(label = puntos$nom),
data = puntos,
size = 3,
#vjust = 0.75,
#hjust = -0.3,
color = "black")
Por lo que mi pregunta sería ¿Cómo puedo importar un mapa en formato shapefile en R para hacerle el mismo tratamiento del script que he resumido antes? Este es el shapefile:
https://drive.google.com/file/d/1H7mxuGJq_qAZUB2xHG4FShisf7ccSvKN/view
Gracias de antemano.