knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )

simpleweather is an R package that provides a simple interface to get historical and forecasted weather. It does one thing: retrieve basic weather data for a given latitude, longitude location. No anguish to figure out which data source to use, esoteric weather variable to pick, or weather station to choose.
simpleweather is focused and therefore limited to only providing temperature (daily max in Fahrenheit), precipitation (True/False), and wind speed (mph). The package leverages NOAA for historical data and OpenWeather for the latest data.
library(simpleweather) dates <- Sys.Date() + -7:2 lat <- 40.7812 long <- -73.9665 get_weather(dates, lat, long)
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("joemarlo/simpleweather")
Requires API keys for the NOAA API and OpenWeather API. You can request those keys for free here and here. Historical NOAA weather data only available for the United States.
And then log your API keys via the set_api_key_* functions.
set_api_key_noaa("<key>") set_api_key_openweather("<key>")
Please credit NOAA and/or OpenWeather as your weather data provider depending on your use.
The data comes from different sources and is aggregated to best provide consistent measures. Some caution is necessary if you require precise estimates as definitions slightly differ across the data sources.
| Type | Source | Dataset | Temperature | Precipitation | Wind |
|-------------|-------------|---------------------------------|-------------------------------------------|-------------------------------------------------------------------|------------------------------------------|
| Historical | NOAA | Daily summaries (GHCND) | TMAX
: Max daily temperature | PRCP
: precipitation > 0.1 inches | WSF2
: fastest 2-minute speed in mph |
| Last 5 days | OpenWeather | One-call time machine "hour" | temp
: Max of the hourly temperatures | weather-main
: description is one of ('Thunderstorm', 'Drizzle', 'Rain', 'Snow') in any hour of the day | wind_speed
: maximum of the hourly reported wind speed in mph |
| Forecast | OpenWeather | One-call "daily" | temp$max
: Max daily temperature | pop
: probability of precipitation > 0.3 | wind_speed
: reported wind speed in mph |
For more detailed weather data, check out the R packages rnoaa and owmr. These provide nuanced control over requesting data from the NOAA and OpenWeather APIs.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.