U/R split graph

This commit is contained in:
flaneuse committed 2016-09-05 17:51:26 -04:00
1 parent c3bdf59fd7
commit c099f0f3c1
2 files changed
+17 -4

No files matched your search

+2 -2
View File
@@ -154,8 +154,8 @@ hh = hh %>%
# Convert regions into urban-rural + region.
hh = hh %>%
mutate(region_urban = case_when(hh$urban == 1 ~ paste0(hh$region_name, ' - urban'),
hh$urban == 0 ~ paste0(hh$region_name, ' - rural'),
mutate(region_urban = case_when(hh$urban == 1 ~ paste0(hh$region_name, '_and_urban'),
hh$urban == 0 ~ paste0(hh$region_name, '_and_rural'),
TRUE ~ NA_character_))
# -- Checks that recoding doesn't change the # of values --
+15 -2
View File
@@ -160,7 +160,6 @@ plotMap(haiti_polygons,
# For krigging, unnecessary to apply weights to each EA (since same)
write_csv(hh, '~/Documents/USAID/Haiti/dataout/HT_DHS2012_imprsanitation_2016-08-29.csv')
x = calcPtEst('impr_water_dhs', by_var = 'region_urban', design = DHSdesign, df = hh)
# Admin2 map --------------------------------------------------------------
@@ -184,4 +183,18 @@ pairGrid(water_admin2,
colorDot = colour_water,
savePlots = TRUE,
fill_limits = colour_limits,
file_name = '~/Creative Cloud Files/MAV/Haiti_WASH-PAD_2016-09/exported_R/HTI_imprwater_adm2dot.pdf')
file_name = '~/Creative Cloud Files/MAV/Haiti_WASH-PAD_2016-09/exported_R/HTI_imprwater_adm2dot.pdf')
# urban/rural splot -------------------------------------------------------
urb_rural_imprwater = calcPtEst('impr_water_under30min', by_var = 'region_urban', design = DHSdesign, df = hh)
urb_rural_imprwater = urb_rural_imprwater %>%
separate(region_urban, c('region', 'urban'), sep = '_and_')
ggplot(urb_rural_imprwater, aes(x = avg, y = region,
fill = avg, shape = urban)) +
geom_point(size = 4)