fcs_heatmap: Plot food consumption scores by region

Description Usage Arguments Value

Description

In its full version, a plot with four parts: (1) a heatmap breaking down the consumption of food groups by region; (2) a kernel density estimate surface of the food consumption scores (FCS) of individual households in the region; (3) a 1 x n heatmap of the average FCS score by region; and (4) individual mini-maps highlighting the region for context.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
fcs_heatmap(df, region_var, map_region_var = region_var, FCS_var = "FCS",
  staples_var = "staples_days", pulse_var = "pulse_days",
  meat_var = "meat_days", milk_var = "milk_days", veg_var = "veg_days",
  oil_var = "oil_days", fruit_var = "fruit_days",
  sugar_var = "sugar_days", low_FCS_top = TRUE, na.rm = FALSE,
  use_sampleWts = FALSE, psu_var = NA, strata_var = NA, weight_var = NA,
  use_FCSWts = TRUE, plot_relativeAvg = TRUE, poor_FCS = 21,
  borderline_FCS = 35, avg_colour = PlBl, FCS_colour = c(brewer.pal(9,
  "YlGnBu"), "#081d58", "#081d58", "#081d58", "#081d58"), FCS_range = c(0,
  112), alpha_hist = 1, font_light = "Lato Light", font_normal = "Lato",
  label_size = 3, heat_stroke_size = 0.15, incl_refHist = FALSE,
  bw = "nrd0", plot_map = TRUE, admin0 = NA, region_coords = NA,
  map_base = grey15K, map_accent = "#d53e4f", width_indivPlots = c(0.1,
  0.6, 0.2, 0.1), filename = NA, width = NA, height = NA, units = "in",
  scale = 1)

Arguments

df

data frame containing the raw, household-level food consumption data. Assumes the individual food group consumption data will be located in separate columns (e.g. legumes, vegetables, etc.)

region_var

string containing the name of the region variable within df

FCS_var

string containing the variable name with calculated FCS

na.rm

T/F on whether to remove NAs from average

use_sampleWts

whether or not to apply sample weights to the average values by region and for the country

psu_var

string containing the primary sampling unit variable name

strata_var

string containing the strata variable name

weight_var

string containing the weight variable name

use_FCSWts

whether or not to weight each food group by its contribution to FCS

plot_relativeAvg

whether to use relative averages or straight averages in main heatmap

poor_FCS

cutoff for a 'poor' FCS score

borderline_FCS

cutoff for a 'borderline' FCS score

avg_colour

colour palette for the main heatmap of the average values of food consumption

FCS_colour

colour palette for the heatmap of avg. FCS by region and distribution

FCS_range

list containing the limist of colors for FCS_colour; default is c(0, 112) – full range of FCS scores

alpha_hist

alpha (opacity) level for the KDE histogram of the FCS scores

admin0

data frame containing lat/long of base of the map. see 'frontier::shp2df' for help importing shapefiles.

region_coords

data frame containing lat/long of the regions of interest to map. see 'frontier::shp2df' for help importing shapefiles.

map_base

colour to fill the base of the map

map_accent

colour to fill the highlighted region of the map

width_indivPlots

list contianing the fraction each panel of the plot should occupy

filename

(optional) filename to save the plots

width

(optional) width of the exported plot

height

(optional) height of the exported plot

units

(optional) units for the width/height of exported plot

scale

(optional) scaling factor for the exported plot

food_vars

list containing the column names containing individual food group consumption

Value

p plot grobs for the 3-4 plots together. Can be rendered by calling 'gridExtra::grid.arrange(p)'


flaneuse/llamar documentation built on May 16, 2019, 1:18 p.m.