Skip to contents

Downloads records of earth quakes from the USGS Earthquake Catalog

Usage

get_earthquakes(
  start_time = today() - 30,
  end_time = NULL,
  min_magnitude = NULL,
  base_url = "https://earthquake.usgs.gov/fdsnws/event/1/query"
)

Arguments

start_time

character string specifying the start date for the records in the form 'yyyy-mm-dd'

end_time

character string specifying the end date for the records in the form 'yyyy-mm-dd'

min_magnitude

numeric quantity specifying the minimum magnitude considered for a record

base_url

base url for the GET request

Value

data frame of earth quake records. Detailed information on each of the variables can be found as part of the [USGS ComCat Documentation](https://earthquake.usgs.gov/data/comcat/index.php). By default, data for the last 30 days is requested from the archive. This is similar data to what USGS provides as `All Earthquakes` for the past 30 days in their spreadsheet/csv feed at https://earthquake.usgs.gov/earthquakes/feed/v1.0/csv.php

Examples

# example code
library(lubridate)
#> 
#> Attaching package: ‘lubridate’
#> The following objects are masked from ‘package:base’:
#> 
#>     date, intersect, setdiff, union
todays <- get_earthquakes(start_time = today()-1, end_time = today())
# all documented earthquakes with a magnitude of at least 9 on the Richter scale
nines <-  get_earthquakes(start_time = "1800-01-01", end_time = today(), min_magnitude=9)