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
getWeatherForDate(station_id, start_date, end_date = NULL,
station_type = "airportCode", opt_detailed = FALSE,
opt_write_to_file = FALSE, opt_temperature_columns = TRUE,
opt_all_columns = FALSE, opt_custom_columns = FALSE,
custom_columns = NULL, opt_verbose = FALSE, daily_min = FALSE,
daily_max = FALSE)
is a valid 3- or 4-letter Airport code or 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
string representing a date in the past ("YYYY-MM-DD", all numeric)
If an interval is to be specified,
end_date is a string representing a date in the past
("YYYY-MM-DD", all numeric) and greater than the
start_date
(Optional)
= "airportCode" (3- or 4-letter airport code) or "ID" (Wx call Sign)
Boolen flag to indicate if detailed records for the station are desired. (default FALSE). By default only one records per date is returned.
Boolean flag to indicate if verbose output is desired
A boolean indicating if only the Minimum Temperatures are desired
A boolean indicating if only the Maximum Temperatures are desired
If TRUE, the resulting dataframe will be stored in a CSV file. Default is FALSE
Boolen flag to indicate only Temperature data is to be returned (default TRUE)
Boolen flag to indicate whether all available data is to be returned (default FALSE)
Boolen flag to indicate if only
a user-specified set of columns are to be returned.
(default FALSE) If TRUE, then the desired columns must be
specified via custom_columns
Vector of integers specified by the
user to indicate which columns to fetch. The Date column
is always returned as the first column. The column
numbers specfied in custom_columns
are appended as
columns of the data frame being returned (default NULL).
The exact column numbers can be found by visiting the
weatherUnderground URL, and counting from 1. Note that if
opt_custom_columns
is TRUE, then
custom_columns
must be specified.
A data frame with each row containing:
Date and Time stamp (for each date specified)
Temperature and/or other weather columns sought
For each day in the date range, this function fetches
Weather Data. Internally, it makes multiple calls to
getDetailedWeather
.
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
dat <- getWeatherForDate("PHNL", "2013-08-10", 2013-08-31")
d3<- getWeatherForDate("CWWF", start_date="2014-03-01",
end_date = "2014-03-03",
opt_detailed = TRUE,
opt_all_columns = TRUE)
Run the code above in your browser using DataLab