Skip to contents

*** DRAFT - NEED TO RECHECK CALCULATIONS This plots the cumulative share of residents found within each distance, for a single population group.

Usage

plot_distance_by_pctd(
  s2b = NULL,
  sitenumber = 1,
  score_colname = names_these[3],
  scorewts_colname = "pop",
  score_label = fixcolnames(score_colname, "r", "shortlabel"),
  radius = 30
)

Arguments

s2b

output of getblocksnearby(), or else can be a table of points with lat,lon columns and 1 row per point. If NULL (not provided as a parameter to the function), will prompt for a file to upload and use, if interactive() is TRUE, or else the function will just show an example using a random point.

sitenumber

If used, one number that is the unique ID (the row number of original list of points) to look at in s2b. This should be the same as the value of s2b$ejam_uniq_id for the site to be analyzed. Will be able to omit or set to NULL to use overall aggregate of all sites.

score_colname

colname in blockgroupstats for an indicator to be aggregated across blocks and blockgroups as a weighted mean

scorewts_colname

colname in blockgroupstats – like "pop" – for the weight to use in aggregating the scores referred to by score_colname

score_label

optional friendly label for the variable

radius

optional radius to use as maximum analyzed or shown – if s2b was provided, this caps what is used and only shorter radii get shown (only relevant if s2b had radii larger than this radius parameter) and if s2b is not provided, interactively RStudio user is prompted to provide latlon file to analyze in getblocksnearby() and radius is used in that.

Value

returns s2b but with more columns in it like wtdmean_within

Details

Also see ejamit_compare_distances() for a plot of several indicators at several distances!

This function uses the distance of each Census block from the site in conjunction with the block group residential population data, to provide a relatively detailed picture of how far away residents in each group live. In contrast, the function distance_cdf_by_group_plot() is based on ejamit()$results_bybg_people, which provides only block group resolution information about distance.

Examples