-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0_main.R
More file actions
61 lines (45 loc) · 1.54 KB
/
0_main.R
File metadata and controls
61 lines (45 loc) · 1.54 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
###
# general workflow structure
###
# download data processing code base
# download data from https://github.com/GeospatialCentroid/COEnviroScreen_dataInput
#
# setup -------------------------------------------------------------------
# load required libraries
# install.packages("pacman")
pacman::p_load(tigris,tidycensus,dplyr,sf,stringr,tictoc,vroom,terra,arcpullr,purrr,tidyr,rmapshaper,readr,lubridate)
# source loadFunctions then load functions
source("R/utils/loadFunctions.R")
loadFunctions()
# create the file folder structure
createFolderStructure()
# copy content from the data repo into the "data/input file folder
# you will be rewriting over the existing folder structure.
# pull geometry layers
getGeometryLayers()
#set version
version <- 2
# set census API key
# tidycensus::census_api_key(key = "your key")
# process data -----------------------------------------------------------
## run single or multiple geometries
geoms <- c("county","censusTract","censusBlockGroup")
# running single component
tic()
processData(processingLevel=geoms[1],
version = version,
overwrite = FALSE)
toc()
# running all components
for(i in geoms){
print(i)
processData(processingLevel=i,
version = version,
overwrite = FALSE)
}
# shiny Elements ------------------------------------------------
shinyData(removeNativeLand = TRUE,
removeZeroPop = TRUE,
version = version,
spanish = FALSE,
overwrite = FALSE)