This function generates a dataframe similar to the
weather dataset from nycflights13
for any US airports and time frame. Please
note that, even with a strong internet connection, this function
may take several minutes to download relevant data.
get_weather(station, year, month = 1:12, dir = NULL)| station | A character vector giving the origin US airports of interest (as the FAA LID airport code). |
|---|---|
| year | A numeric giving the year of interest. This argument is currently not vectorized, as dataset sizes for single years are significantly large. Information for the most recent year is usually available by February or March in the following year. |
| month | A numeric giving the month(s) of interest. |
| dir | An optional character string giving the directory to save datasets in. By default, datasets will not be saved to file. |
ASOS download from Iowa Environmental Mesonet, https://mesonet.agron.iastate.edu/request/download.phtml
A data frame with ~1k-25k rows and 15 variables:
originWeather station. Named origin to facilitate
merging with flights data
year, month, day, hourTime of recording, UTC
temp, dewpTemperature and dewpoint in F
humidRelative humidity
wind_dir, wind_speed, wind_gustWind direction (in degrees), speed and gust speed (in mph)
precipPrecipitation, in inches
pressureSea level pressure in millibars
visibVisibility in miles
time_hourDate and hour of the recording as a POSIXct
date, UTC
get_flights for flight data,
get_airlines for airlines data,
get_airports for airports data,
get_planes for planes data,
or anyflights for a wrapper function.
Use the as_flights_package function to convert this dataset
to a data-only package.
# query weather at Portland International in June 2018
if (FALSE) get_weather("PDX", 2018, 6)
# ...or the original nycflights13 weather dataset
if (FALSE) get_weather(c("JFK", "LGA", "EWR"), 2013)
# use the dir argument to indicate the folder to
# save the data in as "weather.rda"
if (FALSE) get_weather("PDX", 2018, 6, dir = tempdir())