weatherData (version 0.3)

getWeatherForDate: Getting data for a range of dates

Description

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

Usage

getWeatherForDate(station_id, start_date, end_date = NULL,
  daily_min = FALSE, daily_max = FALSE, station_type = "airportCode",
  opt_write_to_file = FALSE)

Arguments

station_id
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
start_date
is a valid string representing a date in the past (YYYY-MM-DD, all numeric)
end_date
(optional) If an interval is to be specified, end_date is a a valid string representing a date in the past (YYYY-MM-DD, all numeric) and greater than start_date
daily_min
A boolean indicating if only the Minimum Temperatures are desired
daily_max
A boolean indicating if only the Maximum Temperatures are desired
station_type
= "airportCode" (3- or 4-letter airport code) or "ID" (Wx call Sign)
opt_write_to_file
If TRUE, the resulting dataframe will be stored in a CSV file. Default is FALSE

Value

  • A data frame with each row containing:
    • Date and Time stamp (for each date specified)
    • Temperature and/or other weather columns sought

Details

For each day in the date range, this function fetches Weather Data. Internally, it makes multiple calls to getWeatherData.

References

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

Examples

Run this code
dat <- getWeatherForDate("PHNL", "2013-08-10", 2013-08-31")

Run the code above in your browser using DataLab