#' get_blockgroups
#'
#' Load Census block group data for Minnesota.
#' @param geoid c(x,y,z) a vector of block group IDs to return
#' @param year The MNRISKS results year. Default value is 2017.
#' @keywords blockgroups block group census
#' @export
#' @examples
#' # All block groups
#' bgs <- get_blockgroups()
#'
#' # A single block group
#' bgs <- get_blockgroups(geoid = c(271090017024))
#
#
get_blockgroups <- function(geoid = NULL, year = 2017) {
e <- new.env()
# Load block group data
bgs <- get(data(list = paste0("bg_census_", year), envir = e), envir = e)
# Filter block groups to given ID num's
if(!is.null(geoid)) {
bgs <- subset(bgs, GEOID %in% geoid)
}
return(bgs)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.