Skip to contents

The function allows users to pull data directly from the FEMA API and have it returned as a data frame natively within R.The FEMA API limits a single query to 1000 records, thus for a query resulting in more than 1000 records, an iterative approach is necessary to get all of the records. The function handles this and will, by default, warn the user of how many iterations are needed to get all the records matching their query, letting the user decide choose whether to continue.


  top_n = NULL,
  filters = NULL,
  select = NULL,
  ask_before_call = TRUE,
  file_type = NULL,
  output_dir = NULL



a character string indicating the data set to get data from


an optional integer value to specify the maximum number of matching records to return


an optional list containing values of the data fields contained in the data set to construct filters from


an optional character vector to specify which data fields to return (default is to return all data fields)


a logical indicating if users should be asked if they would like to proceed when an API call results in a large number of records (default is T).


an optional character string that specifies a file type to save the data as (options are "csv" and "rds"). If a file is specified, the function will not return the api call as a data frame


an optional character string specifying the directory to save the exported file if the file_type is specified (defaults to working directory).


Returns a tibble containing the data from the FEMA API.


if (FALSE) {
data <- open_fema(
  data_set = "fimaNfipClaims", top_n = 100,
  filters = list(countyCode = "10001")