Description Usage Arguments Value Note Examples
Given a vector of U.S. county FIPS codes, this function saves each element of
the lists created from the function daily_fips
to a separate folder
within a given directory. This function therefore allows you to pull and
save weather data time series for multiple counties at once.
The dataframe daily_data
is saved to a
a subdirectory of the given directory called "data." This timeseries
dataframe gives the values for specified weather variables and the
number of weather stations contributing to the average value for each day
within the specified date range. The element station_metadata
, which
gives information about stations contributing to the time series, as well as
statistical information about the values contributed by these stations, is saved
in a subdirectory called "metadata." The element station_map
, which is
a map of contributing station locations, is saved in a subdirectory called
"maps."
1 2 3 4 |
fips |
A string with the five-digit U.S. FIPS code of a county in numeric, character, or factor format. |
coverage |
A numeric value in the range of 0 to 1 that specifies
the desired percentage coverage for the weather variable (i.e., what
percent of each weather variable must be non-missing to include data from
a monitor when calculating daily values averaged across monitors. The
default is to include all monitors with any available data (i.e.,
|
date_min |
A string with the desired starting date in character, ISO format ("yyyy-mm-dd"). The dataframe returned will include only stations that have data for dates including and after the specified date. |
date_max |
A string with the desired ending date in character, ISO format ("yyyy-mm-dd"). The dataframe returned will include only stations that have data for dates up to and including the specified date. |
var |
A character vector specifying desired weather variables. For
example, |
out_directory |
The absolute or relative pathname for the directory where you would like the three subdirectories ("data", "metadata", and "plots") to be created. |
data_type |
A character string indicating that you would like either .rds files (data_type = "rds") or .csv files (data_type = "csv") for the timeseries output. This option defaults to .rds files. |
metadata_type |
A character string indicating that you would like either .rds files (metadata_type = "rds") or .csv files (metadata_type = "csv") for the station metadata output. This option defaults to .rds files. |
average_data |
TRUE / FALSE to indicate if you want the function to average daily weather data across multiple monitors. If you choose FALSE, the function will return a dataframe with separate entries for each monitor, while TRUE (the default) outputs a single estimate for each day in the dataset, giving the average value of the weather metric across all available monitors in the county that day. |
station_label |
TRUE / FALSE to indicate whether to include station labels in the station map. |
keep_map |
TRUE / FALSE indicating if a map of the stations should be included. The map can substantially increase the size of the files, so if file size is a concern, you should consider setting this option to FALSE. If FALSE, the "maps" subdirectory will not be created. |
verbose |
TRUE / FALSE to indicate if you want the function to print the county or vector of counties it's saving files for as the function runs. |
Writes out three subdirectories of a given directory with daily
weather files saved in "data", station metadata saved in "metadata",
and a map of weather station locations saved in "maps" for each FIPS code
specified provided there is available data for that county. The user can
specify either .rds or .csv format for the data and metadata files, using
the arguments data_type
and metadata_type
, respectively.
Maps are saved as .png files.
If the function is unable to pull weather data for a particular county
given the specified percent coverage, date range, and/or weather variables,
daily_timeseries
will not produce files for that county.
1 2 3 4 5 6 7 | ## Not run:
write_daily_timeseries(fips = c("37055", "15005"), coverage = 0.90,
date_min = "1995-01-01", date_max = "1995-01-31",
var = c("tmax", "tmin", "prcp"),
out_directory = "~/timeseries")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.