View source: R/testpoints_bg22.R
testpoints_bg22 | R Documentation |
Get lat lon for random US census block groups (where avg person lives or other weighting)
testpoints_bg22(size, popwtd = TRUE)
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. |
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.
data.frame with columns lon and lat, in decimal degrees
#library(jsonlite)
#library(httr)
#library(tidyverse) # need magrittr
#library(data.table)
#library(sf)
# pts <- proxistat::testpoints_bg22(10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.