get_weather {anyflights}R Documentation

Query nycflights13-Like Weather Data

Description

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.

Usage

get_weather(station, year, month = 1:12, dir = NULL)

Arguments

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.

Value

A data frame with ~1k-25k rows and 15 variables:

origin

Weather station. Named origin to facilitate merging with flights data

year, month, day, hour

Time of recording, UTC

temp, dewp

Temperature and dewpoint in F

humid

Relative humidity

wind_dir, wind_speed, wind_gust

Wind direction (in degrees), speed and gust speed (in mph)

precip

Precipitation, in inches

pressure

Sea level pressure in millibars

visib

Visibility in miles

time_hour

Date and hour of the recording as a POSIXct date, UTC

Source

ASOS download from Iowa Environmental Mesonet, https://mesonet.agron.iastate.edu/request/download.phtml

See Also

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.

Examples


# query weather at Portland International in June 2018
## Not run: get_weather("PDX", 2018, 6)

# ...or the original nycflights13 weather dataset
## Not run: get_weather(c("JFK", "LGA", "EWR"), 2013)

# use the dir argument to indicate the folder to 
# save the data in as "weather.rda"
## Not run: get_weather("PDX", 2018, 6, dir = tempdir())


[Package anyflights version 0.3.4 Index]