Skip to content
Snippets Groups Projects
Commit 89822c5c authored by Azadpour, Elmera's avatar Azadpour, Elmera
Browse files

drop empty census vars and maps

parent bd8897fd
No related branches found
No related tags found
1 merge request!12Add disaggregated census data/maps
......@@ -87,10 +87,8 @@ tar_target(p2_census_acs5sub_age_data,
iteration = "list"),
# income related variables
# S1901_C01_014 = Estimate!!Households!!PERCENT ALLOCATED!!Household income in the past 12 months
# S1901_C01_015 = Estimate!!Households!!PERCENT ALLOCATED!!Family income in the past 12 months
# S1901_C01_016 = Estimate!!Households!!PERCENT ALLOCATED!!Nonfamily income in the past 12 months
tar_target(p2_census_acs5sub_income_layers,
c("S1901_C01_014", "S1901_C01_015", "S1901_C01_016")),
c("S1901_C01_014")),
tar_target(p2_census_acs5sub_income_data,
get_census_data(geography = 'county', variable = p2_census_acs5sub_income_layers,
states = p1_census_states, year = 2022, proj = p1_proj,
......
......@@ -264,50 +264,6 @@ p3_targets <- list(
),
format = "file"
),
tar_target(
# empty map
p3_perc_family_income_map_png,
plot_census_map(
census_data = p2_census_acs5sub_income_data[[2]],
percent_leg = TRUE,
var = 'percent',
conus_sf = p1_conus_sf,
outfile_path = "3_visualize/out/perc_family_income_2022.png",
pal = "OrRd",
leg_title = "Percent allocated\family income\nin the past 12 months, 2022",
width = 6,
height = 4,
dpi = 300,
counties_outline_col = "grey80",
conus_outline_col = 'grey50',
bg_col = "white",
load_font = 'Source Sans Pro',
font_size = 10
),
format = "file"
),
tar_target(
# empty map
p3_perc_nonfamily_income_map_png,
plot_census_map(
census_data = p2_census_acs5sub_income_data[[3]],
percent_leg = TRUE,
var = 'percent',
conus_sf = p1_conus_sf,
outfile_path = "3_visualize/out/perc_nonfamily_income_2022.png",
pal = "OrRd",
leg_title = "Percent allocated\nonfamily income\nin the past 12 months, 2022",
width = 6,
height = 4,
dpi = 300,
counties_outline_col = "grey80",
conus_outline_col = 'grey50',
bg_col = "white",
load_font = 'Source Sans Pro',
font_size = 10
),
format = "file"
),
# education related map
tar_target(
p3_tot_18_24_highschool_education_map_png,
......
......@@ -13,8 +13,7 @@
#' @param bg_col, assign background color for maps
#' @param load_font, assign font name
#' @param percent_leg if else statement where if TRUE, apply 0-100 legend, otherwise retain 0 - max of variable name
plot_census_map <- function(census_data, conus_sf, pal, leg_title, outfile_path, width, height, dpi,
counties_outline_col, conus_outline_col, bg_col, load_font, font_size, var, percent_leg){
plot_census_map <- function(census_data, conus_sf, pal, leg_title, outfile_path, width, height, dpi, counties_outline_col, conus_outline_col, bg_col, load_font, font_size, var, percent_leg){
font_legend <- load_font
font_add_google(font_legend)
......@@ -40,7 +39,7 @@ plot_census_map <- function(census_data, conus_sf, pal, leg_title, outfile_path,
position = "bottom",
barwidth = 20,
barheight = 1
)
))
if (percent_leg == FALSE) {
census_map <- census_map +
......@@ -64,4 +63,4 @@ plot_census_map <- function(census_data, conus_sf, pal, leg_title, outfile_path,
ggsave(outfile_path, census_map, width = width, height = height, dpi = dpi, bg = bg_col)
return(outfile_path)
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment