inmetr provides verified INMET automatic weather station data for lazy R queries and nearby-station lookup.

Experimental: The package is under active development, and its interface may change.

Install from GitHub:

# remotes::install_github("viniciusoike/inmetr")
install.packages("inmetr", repos = c('https://viniciusoike.r-universe.dev', 'https://cloud.r-project.org'))

Find a station near São Paulo and collect its daily observations for 2024:

library(inmetr)

stations <- inmet_nearest(3550308, n = 1)
daily <- read_inmet("daily", years = 2024)
city_daily <- daily |>
  dplyr::filter(.data$code_station %in% stations$code_station) |>
  dplyr::collect()

The data release is downloaded on first use into the user cache. Downloaded files are checked against their SHA-256 hashes. Later reads check file size; use inmet_cache_clear() to recover from suspected cache corruption.

Daily rows carry n_hours for overall coverage. The staged schema 3 release adds a n_hours_* column for each aggregate; these columns become available by default after publication and the package data-version update. The current default release uses schema 2.