testpoints_bg22: Get lat lon for random US census block groups (where avg...

View source: R/testpoints_bg22.R

testpoints_bg22R Documentation

Get lat lon for random US census block groups (where avg person lives or other weighting)

Description

Get lat lon for random US census block groups (where avg person lives or other weighting)

Usage

testpoints_bg22(size, popwtd = TRUE)

Arguments

size

number of unique test points needed (no duplicates will be returned)

popwtd

default is TRUE, and pop weighted points represent block group where the avg US resident lives. If FALSE, unweighted, so each block group has equal chance of being selected.

Details

Note this is not optimized for speed. can be slow if pop wtd. May recode this to allow wts to be pop, area, or none (no weight). Area weighted would mean a random location means each square meter is equally likely to be picked, like throwing a dart at a map except it is rounded to the nearest internal point. Since block groups generally almost all tend to have somewhat similar pop counts, popwtd and bg fips wtd are not all that different. But square meters varies a lot, so area weighted is very different than pop or fips weighted.

Value

data.frame with columns lon and lat, in decimal degrees

Examples

#library(jsonlite)
#library(httr)
#library(tidyverse) # need magrittr
#library(data.table)
#library(sf)
# pts <- proxistat::testpoints_bg22(10)
# benchmark.start <- Sys.time()
# outlist <- batch.summarizer::ejscreenapi(pts$lon, lat=pts$lat, radius = 5)
# benchmark.end <- Sys.time()
# proxistat::speedsummary(benchmark.start, benchmark.end, NROW(pts))
 

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