getWeatherForMultipleYears: For Multiple Years, fetch the weather data for a station

Description Usage Arguments Details Value References Examples

Description

Function will return a data frame with all the records for a given station_id for all the years requested. 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

Usage

1
2
3
4
5
6
getWeatherForMultipleYears(station_id, start_year, end_year,
  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)

Arguments

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 getStationCode()

start_year

is a valid year in the past (numeric, YYYY format)

end_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 multiple records for each day ("detailed") for the station are desired. Default is FALSE. By default only one record per date is returned.

opt_write_to_file

If TRUE, the resulting dataframe will be stored in a CSV file. Default is FALSE

opt_temperature_columns

Boolen flag to indicate only Temperature data is to be returned (default TRUE)

opt_all_columns

Boolen flag to indicate whether all available data is to be returned (default FALSE)

opt_custom_columns

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

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.

opt_verbose

Boolean flag to indicate if verbose output is desired

daily_min

A boolean indicating if only the Minimum Temperatures are desired

daily_max

A boolean indicating if only the Maximum Temperatures are desired

Details

Note that this function is a light wrapper for getWeatherForYear

Value

A data frame with each row containing:

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

1
2
3
4
5
6
7
## Not run: 
dat <- getWeatherForMultipleYears("SFO", 2013, 2017)

# If opt_detailed is turned on, you will get a large data frame
wx_singapore <- getWeatherForMultipleYears("SIN", 2014, 2017, opt_detailed=TRUE)

## End(Not run)

Ram-N/weatherData documentation built on May 8, 2019, 8:05 a.m.