Barplot of Average Proximity, by Group
Source:R/plot_distance_mean_by_group.R
plot_distance_mean_by_group.Rd
Shows distance to sites, for residents in each population group (vs everyone else). plot_distance_mean_by_group() and plot_distance_by_group() are synonymous.
distance_mean_by_group() and distance_mean_by_group() are synonymous, and are like
plot_distance_mean_by_group()
, but show a table not plot, by default.
Usage
plot_distance_mean_by_group(
results_bybg_people,
demogvarname = NULL,
demoglabel = fixcolnames(demogvarname, "r", "shortlabel"),
graph = TRUE,
returnwhat = "table"
)
plot_distance_by_group(
results_bybg_people,
demogvarname = NULL,
demoglabel = fixcolnames(demogvarname, "r", "shortlabel"),
graph = TRUE,
returnwhat = "table"
)
distance_mean_by_group(
results_bybg_people,
demogvarname = NULL,
demoglabel = fixcolnames(demogvarname, "r", "shortlabel"),
returnwhat = "table",
graph = FALSE
)
distance_by_group(
results_bybg_people,
demogvarname = NULL,
demoglabel = fixcolnames(demogvarname, "r", "shortlabel"),
returnwhat = "table",
graph = FALSE
)
Arguments
- results_bybg_people
data.table from
doaggregate()$results_bybg_people
- demogvarname
vector of column names like "pctlowinc" etc.
- demoglabel
vector of labels like "Low Income Residents" etc.
- graph
logical optional, set to FALSE to not show the barplot and only save the file of it
- returnwhat
If returnwhat is "table", invisibly returns a data.frame with group, ratio, avg_distance_for_group, avg_distance_for_nongroup. If returnwhat is "plotfilename" then it returns the full path including filename of a .png in a tempdir If returnwhat is "plot" then it returns the plot object as needed for table_xls_format() ?
Details
Note that the ratio shown is a ratio of distance among others to distance of a given group, so values below 1 mean the given group lives closer to facilities. A value of 0.85 would mean the group is only 85% as far from a site as everyone else.
Note it is in miles assuming input was in miles, and the distance for each resident is actually the average distance of all residents within their Census block (not block group), and when a site is very close to the block internal point (like a centroid) relative to the size of the block, the distance to the average resident in the block is estimated as 90 percent of the effective radius, which is what the radius of the block would be if it were the same area in square meters or miles but circular in shape.
This is the approach used in EJScreen to estimate average proximity of a block resident in
cases where the block is extremely close to the site or the site may actually be inside the block,
or exactly on top of the internal point of the block, in which case zero would not be an
appropriate estimate of the distance, hence this adjustment is made in EJAM getblocksnearby()
See also
distance_by_group()
distance_by_group_plot()