knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
stop('Dont knit this.')
This vignette documents the creation of the FIA_plot_weather
data object. The DaymetWeatherGrab
function will require restarting once in a while because of intermittent file download errors, and will throw an error if the saved file has been completely downloaded already - just increment the starting year when this happens.
data("FIA_mortality_with_explanatory") lats <- FIA_mortality_with_explanatory$LAT lons <- FIA_mortality_with_explanatory$LON out <- "C:/Users/Brandon/Documents/docs/R_workspace/RSFIA/inst/extdata/daymet" daymet_vars <- RSFIA::ShowDaymetMeta()$fixed_name[2:8] weather_data <- RSFIA::DaymetWeatherGrab(lats, lons, start_year = '2000', end_year = '2016', out_dir = out, vars = daymet_vars)
This part modifies the data. Solar data was not very informative in preliminary trials and also significantly collinear, as was the rain variables sum_rain
and mean_rain
. Since mean_rain
is effectively MAP, sum_rain
is dropped here.
weather_data <- RSFIA::CombineWeatherFiles(dir = out) weather_data <- data.frame( weather_data[, c(1, 2)], RSFIA::CollapseIdenticalVars(weather_data[, -c(1, 2)]), stringsAsFactors = F) colnames(weather_data)[1:2] <- c('lat', 'lon') weather_data <- weather_data[, -grep('sum_rain', colnames(weather_data))] colnames(weather_data) <- gsub('mean_rain$', 'MAP', colnames(weather_data)) colnames(weather_data) <- gsub('mean_max_min', 'MAT', colnames(weather_data)) weather_data <- weather_data[, -grep('solar', colnames(weather_data))]
Once data is modified, this code will save it as an .Rmd
:
FIA_plot_daymet <- weather_data devtools::use_data(FIA_plot_daymet, overwrite = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.