Given a specified date range, the function makes an API request to the OpenWeather Air Pollution API and fetches historic pollution data for a given location.

get_pollution_history(start_date, end_date, lat, lon, api_key)

Arguments

start_date

The start date as a UNIX timestamp, e.g. 1606488670

end_date

The end date as a UNIX timestamp, e.g. 1606747870

lat

Latitude coordinate for a given location as a double

lon

Longitude coordinate for a given location as a double

api_key

The API key for OpenWeather as a string

Value

data frame containing pollution history

Details

Note: Historical data is accessible from 27th November 2020

Examples

get_pollution_history(1606488670, 1606747870, 49.28, 123.12, "APIKEY_example")
#> [1] "An error occurred fetching data from the API"