Skip to contents

Hits the USGS FDSN /count endpoint with the same parameters as get_quakes(), returning only the integer event count. Use this before a large query to check whether you'll hit the 20,000-event cap.

Usage

count_quakes(
  start_time,
  end_time = Sys.time(),
  min_mag = 2.5,
  min_lat = -90,
  max_lat = 90,
  min_lng = -180,
  max_lng = 180,
  order_by = "time",
  limit = NULL
)

Arguments

start_time

POSIXct or character (e.g. "2026-03-01"). Start of the query window (UTC).

end_time

POSIXct or character. End of the query window (UTC). Defaults to now.

min_mag

Minimum magnitude. Default 2.5.

min_lat, max_lat

Latitude bounds. Default global (-90, 90).

min_lng, max_lng

Longitude bounds. Default global (-180, 180).

order_by

Sort order: "time" (default), "time-asc", "magnitude", or "magnitude-asc".

limit

Maximum events to return (max 20,000). NULL uses the USGS default.

Value

Integer. Number of events matching the query.

Examples

if (FALSE) { # \dontrun{
n <- count_quakes(
  start_time = "2026-01-01",
  end_time   = "2026-04-01",
  min_mag    = 2.5
)
n
} # }