Skip to contents

utility - How many blocks and many other stats about blocks and sites

Usage

getblocks_diagnostics(
  x,
  detailed = FALSE,
  see_pctiles = FALSE,
  see_distanceplot = FALSE
)

Arguments

x

The output of getblocksnearby() like testoutput_getblocksnearby_10pts_1miles

detailed

if TRUE, also shows in console a long table of frequencies via getblocks_summarize_blocks_per_site()

see_pctiles

set to TRUE to see 20 percentiles of distance in a table

see_distanceplot

if TRUE, also draws scatter plot of adjusted vs unadj distances

Value

A list of stats

Examples

  getblocks_diagnostics(testoutput_getblocksnearby_10pts_1miles)
#> 
#>    DISTANCES FROM BLOCKS (AND RESIDENTS) TO SITES (AND FOR CLOSEST SITE) 
#> 
#> 0.9999117 miles is max. distance to block internal point (distance_unadjusted)   
#> 0.9999117 miles is max. distance to average resident in block (distance reported)   
#> 0.02554516 miles is shortest distance to block internal point (distance_unadjusted)   
#> 0.02554516 miles is shortest distance to average resident in block (distance reported)   
#> 0 block distances were adjusted (these stats may count some blocks twice if adjusted at 2+ sites)
#>   0 block distances were adjusted up (reported dist to avg resident is > dist to block internal point)
#>   0 block distances were adjusted down (reported < unadjusted)
#> 0 unique sites had one or more block distances adjusted due to large block and short distance to block point
#> 
#>   BLOCK COUNTS PER SITE (FEWER MEANS HIGHER UNCERTAINTY AT THOSE SITES)
#> 
#> 164 blocks are near the avg site or in avg buffer
#> (based on their block internal point, like a centroid)
#> 
#>   sites    blocks_per_site
#> 1     0         Not even 1
#> 2     0       some but <10
#> 3     0              10-29
#> 4    10 at least 30 blocks
#> 
#>   BLOCK COUNTS TOTAL AND IN OVERLAPS OF AREAS (MULTIPLE SITES FOR SOME RESIDENTS) 
#> 
#> 1,640 actual unique blocks total
#> 1,640 blocks including doublecounting in overlaps, 
#>              in final row count (block-to-site pairs table)
#> 1 is ratio of blocks including multicounting / actual count of unique blocks
#> 0% of unique blocks could get counted more than once 
#>              because those residents are near two or more sites 
#>              (assuming they live at the block internal point
#> 
#>   SITE COUNTS TOTAL AND IN OVERLAPS OF AREAS (MULTIPLE SITES FOR SOME RESIDENTS)
#> 
#> 10 unique output sites
#> 
#> 1,640 blocks (and their residents) have exactly 1 site nearby 
#> 0 blocks (and their residents) have exactly 2 sites nearby 
#> 0 blocks (and their residents) have exactly 3 sites nearby 

  # library(data.table)
  x <- data.table::copy(testpoints_10)
  setDT(x)
#> Error in setDT(x): could not find function "setDT"
  pts <- rbind(data.table(lat = 40.3, lon = -96.23),
    x[ , .(lat, lon)])
#> Error in data.table(lat = 40.3, lon = -96.23): could not find function "data.table"
 z <- getblocksnearbyviaQuadTree(pts, 1, quadtree = localtree, quiet = T)
#> Error: object 'pts' not found
 z[ , .(blocks = .N) , keyby = 'ejam_uniq_id']
#> Error: object 'z' not found
 plotblocksnearby(pts, radius = 1, sites2blocks = z)
#> Error: object 'pts' not found
 zz <- getblocks_diagnostics(z, detailed = T, see_pctiles = T)
#> Error: object 'z' not found
cbind(stats = zz)
#> Error: object 'zz' not found

  getblocks_diagostics(testoutput_getblocksnearby_1000pts_1miles, see_distanceplot = TRUE)
#> Error in getblocks_diagostics(testoutput_getblocksnearby_1000pts_1miles,     see_distanceplot = TRUE): could not find function "getblocks_diagostics"