R/us_population_details.R

Defines functions us_population_details

Documented in us_population_details

#' Retrieve United States Population data from the US Census Bureau
#'
#' Get data from the US Census Bureau Population Estimates APIs.
#'
#' @param \dots Passed along to \code{\link[tidycensus]{get_estimates}}. Typical 
#'   arguments would be something like `(geography='county', product='population', year=2019)`.
#' 
#' @seealso \code{link[tidycensus]{get_estimates}}
#'
#' @author Sean Davis <seandavi@gmail.com>
#' 
#' @return a `data.frame`
#'
#' @examples
#' res = us_population_details(geography='county', 
#'   product='population', year=2019)
#' head(res)
#'
#' @export
us_population_details <- function(...) {
  if(!requireNamespace("tidycensus")) {
    message("The tidycensus package is required for this ")
    message("functionality. Please install it first.")
    stop()
  }
  tidycensus::get_estimates(...)
}
seandavi/sars2pack documentation built on May 13, 2022, 3:41 p.m.