Shapefiles to raster
Inside the Data-shp folder, you will find two sets of shapefiles. They are composed of several files and in order for them to work properly keep them all.
First, we will transform those shapefiles to Raster files with the help of rgdal.
#install.packages(c("rgdal","openxlsx") #only once library(rgdal) library(raster) library(landscapemetrics) library(tidyverse) library(ggsci) library(ggpubr) library(openxlsx) Read the shape files with readOGR.
try_map <- readOGR("Data-shp/GLYlanduse.shp") #read your file Plot the map.
plot(try_map) Currently, the map does not have a set of CRS so we will assign them to it because it is required for further analysis.