-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.R
More file actions
executable file
·58 lines (43 loc) · 1.85 KB
/
main.R
File metadata and controls
executable file
·58 lines (43 loc) · 1.85 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
# calling the workflow \
pacman::p_load(dplyr, terra, sf, tmap, purrr, furrr, readr)
# download population data
print("downloading population data")
source("scripts/0_downloadPopulationData.R")
# select top 200 cities
print("prepping top 200 cities")
if (!file.exists("data/processed/top200/top200Cities.gpkg")) {
source("scripts/1_selectTop200Cities.R")
}
# this dataset is all good to go, complete re
## gives up city name, state, county GEOID, and total population of city
# download NDVI
## python method
# download census geographies
print("grabbing census data")
source("scripts/3_downloadCensusGeographies.R")
# generate city pop for 35 and 55 and older
source("scripts/3b_55plusInCities.R")
#
# process water files
print("processing lakes and oceans")
source("scripts/4_processWaterFiles.R")
# Download data from Google Drive using the gdown package.
# Ensure that gdown is installed, or install it using pacman::p_load(gdown).
# The script assumes you have a file ID for the Google Drive document you want to download.
gdown::download(id = "your_google_drive_file_id", destfile = "path_to_save_downloaded_file")
## unlikely to work due to unique id to drive folder.
## should only need after python pull from GEE script is rerun
print("grabbing data from google drive")
# requires the authenitcation so can't run from terminal
try(source("scripts/5_pullDataFromDrive.R"))
# calculate ndvi per city
# does a lot of processing through calling three independent scripts
## process water from NDVI
## process NDVI to city area
## process NDVI to census Tract area
print("Processing NDVI values for cities and tracts")
source("scripts/6_ndviPerCity.R")
# apply the metric to the ndvi and population data
source("scripts/7_applyHealthMetrics.R")
# city export : "data/products/healthMeasures/allCities_2023_morDemStroke_with10percentAdjust.csv"
# move data to the shiny app