-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
40 lines (40 loc) · 1.31 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
library(tidyverse)
library(sf)
library(tmap)
library(Hmisc) # for %nin% (not in)
library(viridis)
### file paths -----------------------------------------------------------------
wd <- "~/CRAFTY-opm" # sandbox VM
dirData <- file.path(wd, 'data-raw')
dirOut <- file.path(wd, 'data-processed')
### join files with type and ownerIDs ------------------------------------------
hexType <- st_read(paste0(dirOut, "/hexGrids/hexGrid40m_types2.shp"))
hexOwner <- st_read(paste0(dirOut,"/capitals/hexG_ownerIDs2.shp"))
hexType <- hexType[,c(1,21)]
hexType <- as.data.frame(hexType)
hexType$geometry <- NULL
hexSocial <- merge(hexType,hexOwner,by="joinID")
hexSocial <- st_as_sf(hexSocial)
# check
type.pal <- c("Amenity.residential.business" = "grey",
"Amenity.transport" = "darkgrey",
"Private.garden" = "#483D8B",
"Public.park" = "#008000",
"School.grounds" = "#2F4F4F",
"Religious.grounds" = "#2F4F4F",
"Institutional.grounds" = "#2F4F4F",
"Non.greenspace" = "white",
"Play.space" = "#008080",
"Playing.field" = "#008080",
"Other.sports" = "#00FA9A",
"Tennis.court" = "#00FA9A",
"Bowling.green" = "#00FA9A",
"Allotments" = "#B8860B",
"Cemetery" = "#696969",
"Natural" = "white",
"NA" = "red")
ggplot()+
geom_sf(hexSocial, mapping = aes(fill = type), col = NA)+
scale_fill_manual(values=type.pal)
# new risk perception variable
hexSocial$riskPerc <- NA