weatherData (version 0.3)

getDailyMinMaxTemp: Get the daily minimum (maximum) temperatures for a given weather stations

Description

Given a StationID and a set of dates, this function returns the Daily Minimum and/or Maximum temperatures recorded, along with timestamps

Usage

getDailyMinMaxTemp(station_id, start_date, end_date = NULL,
  daily_min = TRUE, daily_max = TRUE, 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 the Minimum Temperatures are desired
daily_max
A boolean indicating if the Maximum Temperatures are desired Both daily_min and daily_max can be TRUE, but at least one of them should be TRUE.
station_type
= "airportCode" 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 when that day's minimum temperature was recorded)
    • Minimum Temperature for the station in Farenheit (or Celcius)
    • Date and Time stamp (for when that day's maximum temperature was recorded)
    • Maximum Temperature for the station in Farenheit (or Celcius)

Details

This functions fetches all the records for each date specified, but it only retaints the min and/or max record, along with the timestamp.

Examples

Run this code
dat <- getDailyMinMaxTemp("KIAH", "2013-08-10", 2013-08-31", daily_max=TRUE)
dat <- getDailyMinMaxTemp("KBIL", "2013-08-10", daily_max=T)
dat <- getDailyMinMaxTemp("EGLL", "2013-08-10", daily_max=T, daily_min=TRUE)

Run the code above in your browser using DataLab