Description Usage Arguments Details Value References Examples
View source: R/wrapper_functions.R
Function will return a data frame with all the records for a given station_id and year. If the current year is supplied, it will return records until the current Sys.Date() ("today")
This function will return a (fairly large) data frame. If you are going
to be using this data for future analysis, you can store the results in a CSV file
by setting opt_write_to_file
to be TRUE
1 2 | getWeatherForYear(station_id, year, station_type = "airportCode",
opt_detailed = FALSE, opt_write_to_file = FALSE)
|
station_id |
is a valid Weather Station ID
(example: "BUF", "ORD", "VABB" for Mumbai).
Valid Weather Station "id" values: "KFLMIAMI75" or "IMOSCOWO2" You can look these up
at wunderground.com. You can get station_id's for a given location
by calling |
year |
is a valid year in the past (numeric, YYYY format) |
station_type |
= "airportCode" (3 or 4 letter airport code) or "ID" (Wx call Sign) |
opt_detailed |
Boolen flag to indicate if detailed records for the station are desired. (default FALSE). By default only one records per date is returned. |
opt_write_to_file |
If TRUE, the resulting dataframe will be stored in a CSV file. Default is FALSE |
Note that this function is a light wrapper for getWeatherForDate with the two end dates being Jan-01 and Dec-31 of the given year.
For each day in the date range, this function fetches Weather Data.
Internally, it makes multiple calls to getDetailedWeather
.
A data frame with each row containing:
Date and Time stamp (for each date specified)
Temperature and/or other weather columns sought
For a list of valid Weather Stations, try this format http://www.wunderground.com/weatherstation/ListStations.asp?selectedCountry=United+States and replace with your country of interest
1 2 3 4 5 6 7 | ## Not run:
dat <- getWeatherForYear("KLGA", 2013)
# If opt_detailed is turned on, you will get a large data frame
wx_Singapore <- getWeatherForYear("SIN", 2014, opt_detailed=TRUE)
## End(Not run)
|
URL to Try:
https://www.wunderground.com/history/airport/KLGA/2013/1/1/CustomHistory.html?dayend=31&monthend=12&yearend=2013&req_city=NA&req_state=NA&req_statename=NA&format=1
Retrieving from: https://www.wunderground.com/history/airport/KLGA/2013/1/1/CustomHistory.html?dayend=31&monthend=12&yearend=2013&req_city=NA&req_state=NA&req_statename=NA&format=1
URL does not seem to exist: https://www.wunderground.com/history/airport/KLGA/2013/1/1/CustomHistory.html?dayend=31&monthend=12&yearend=2013&req_city=NA&req_state=NA&req_statename=NA&format=1
The original error message:
Could not resolve host: www.wunderground.comChecking Summarized Data Availability For KLGA
Found 0 records for 2013-01-01 to 2013-12-31
Data is Not Available
Warning message:
In isObtainedDataValid(wxdata, station_id, custom_url) :
There seems to be no data in the URL.
Try going to the URL via your browser and seeing if there is data.
Inspect the validity of the URL being tried:
https://www.wunderground.com/history/airport/KLGA/2013/1/1/CustomHistory.html?dayend=31&monthend=12&yearend=2013&req_city=NA&req_state=NA&req_statename=NA&format=1
Getting data from:
https://www.wunderground.com/history/airport/SIN/2014/1/1/DailyHistory.html?format=1
URL does not seem to exist: https://www.wunderground.com/history/airport/SIN/2014/1/1/DailyHistory.html?format=1
The original error message:
Could not resolve host: www.wunderground.comGetting data from:
https://www.wunderground.com/history/airport/SIN/2014/12/31/DailyHistory.html?format=1
URL does not seem to exist: https://www.wunderground.com/history/airport/SIN/2014/12/31/DailyHistory.html?format=1
The original error message:
Could not resolve host: www.wunderground.comChecking Data Availability For SIN
Found 0 records for 2014-01-01
Found 0 records for 2014-12-31
Data is Not Available
Warning messages:
1: In getDetailedWeather(station_id, start_date, station_type, opt_temperature_columns = T, :
Unable to get data from URL
Check if URL is reachable
2: In getDetailedWeather(station_id, end_date, station_type, opt_temperature_columns = T, :
Unable to get data from URL
Check if URL is reachable
3: In getWeatherForDate(station_id, first_day, last_day, station_type, :
Station data not available. SIN 2014-01-01 to 2014-12-31
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.