Description Usage Arguments Value Note Examples
Retrieve average daily weather data per US county.
1 2 3 4 5 6 7 | daily_climate(
fips,
var = c("prcp", "snow", "snwd", "tmax", "tmin"),
date_min = "2015-01-01",
date_max = "2015-12-31",
coverage = 0.9
)
|
fips |
A string with the five-digit U.S. FIPS code of a county in numeric, character, or factor format. |
var |
A character vector specifying desired weather variables. For
example, |
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. |
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.,
|
A dataframe of daily weather data averaged across multiple stations.
The function uses the NOAA API to identify the weather monitors within a U.S. county, you will need to get an access token from
NOAA to use this function. Visit NOAA's token request page (https://www.ncdc.noaa.gov/cdo-web/token) to request a token by
email. You then need to set that API code in your R session (e.g., using options(noaakey = "your key")
, replacing "your key"
with the API key you've requested from NOAA).
1 2 3 4 5 6 7 8 | ## Not run: s
climate <- daily_climate(fips = '06001',
var = c('prcp', 'snow', 'snwd', 'tmax', 'tmin'),
date_min = '2015-01-01',
date_max = '2015-12-31',
coverage = 0.90)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.