proxistat.rollup: Convert Census Block Proximity Statistics to Block Group...

View source: R/proxistat.rollup.R

proxistat.rollupR Documentation

Convert Census Block Proximity Statistics to Block Group Statistics

Description

Aggregate proximity statistics already calculated for each Census block, up to one summary for each Census block group. The resulting proximity score, distance to nearest single point, or count of nearby points is just the population-weighted mean of values in the blocks within a given block group.

Usage

proxistat.rollup(output, blocksfips, blocksfipsbg, blockspop)

Arguments

output

Required matrix of results from proxistat or proxistat.chunked. Must be same number of rows and order as blocksfips. Output parameter must be output of proxistat or proxistat.chunked and contain the colname scores, and can also have colnames nearestone.d and/or count.near.

blocksfips

Required character vector of 15-digit Census block FIPS codes (not numeric, must have leading zeroes as needed).

blocksfipsbg

Required character vector of 12-digit Census block group FIPS codes (not numeric, must have leading zeroes as needed). Same length and order as blocksfips.

blockspop

Required numeric vector of population counts in Census blocks. Same length and order as blocksfips.

Details

The population-weighted mean might not be the only statistic of interest.
To get the maximum count of sites near any single block in the block group, try aggregate(output[ , 'count.near'], by=list(blocks$FIPS.BG), FUN=max).
To get the shortest distance from any block in the block group to the nearest site, try aggregate(output[ , 'nearestone.d'], by=list(blocks$FIPS.BG), FUN=min).
To find out how many unique sites are within X km of the internal point of any block in the block group, for example, is harder, because it requires retaining details on which sites were near a given block, i.e., much more data would be the input to an aggregating function.

Value

Returns a data.frame with FIPS.BG and same fields proxistat can provide (depending on what is in the parameter called output): scores, nearestone.d, count.near, but with one row for each of the block groups defined by FIPS.BG. Units (miles or km) are unchanged from those used to create input parameters.

See Also

proxistat and proxistat.chunked to create proximity statistics, and see get.distances and get.distances.all for distances between points, and get.nearest which finds the distance to the single nearest point within a specified search radius instead of all topoints. See also rollup via http://ejanalysis.github.io/ejanalysis/

Examples

## Not run: 
# require(Hmisc); require(data.table)
# require("devtools") # to obtain packages via devtools::github_install()
#  These are on github.com/ejanalysis, e.g.  https://github.com/ejanalysis/UScensus2010blocks
# require(analyze.stuff); require(ejanalysis)
# require(UScensus2010blocks) # for the get.blocks() function and dataset
# blocks <- UScensus2010blocks::get.blocks()
# bgp <- proxistat.rollup(output=output, blocksfips=blocks$fips, blocksfipsbg=blocks$FIPS.BG, blockspop=blocks$pop)

## End(Not run)

ejanalysis/proxistat documentation built on April 2, 2024, 10:13 a.m.