data("FIA_mortality_with_explanatory") mort_df <- FIA_mortality_with_explanatory #for (i in c(5, 8, 10)) { # for (j in c('NDVI', 'NDMI', 'RGI', 'MIR')) { # cat('\n\n Variable:', j, '\n', 'Year span:', i, '\n\n') # mort_df <- RSFIA::ApplyColumnAggregate(df = mort_df, n_yr_prev = i, var_in = j) # colnames(mort_df)[ncol(mort_df)] <- paste(j, i, sep = '_') # cat('Done!\n') # save.image() # } #} #incl_vars <- c('LAT', 'LON', 'NDVI_5', 'NDVI_8', 'NDVI_10', # 'NDMI_5', 'NDMI_8', 'NDMI_10', # 'RGI_5', 'RGI_8', 'RGI_10', # 'MIR_5', 'MIR_8', 'MIR_10') #FIA_spectrals_by_year_bin <- mort_df[, incl_vars] #use_data(FIA_spectrals_by_year_bin) weather_vars <- c('MAT', 'min_temp_by_Q_val', 'max_temp_by_Q_val', 'MAP', 'dry_Q_sum', 'mean_dry_period') # MAP might be broken here - scale is from 0-12, unsure of units for (i in c(2, 5, 10)) { for (j in c(weather_vars)) { cat('\n\n Variable:', j, '\n', 'Year span:', i, '\n\n') mort_df <- RSFIA::ApplyColumnAggregate(df = mort_df, type = 'daymet', n_yr_prev = i, var_in = j) colnames(mort_df)[ncol(mort_df)] <- paste(j, i, sep = '_') cat('Done!\n') save.image() } } incl_vars <- c('LAT', 'LON', colnames(mort_df)[310:ncol(mort_df)]) mort_df <- mort_df[, incl_vars] which_MAP <- grep(colnames(mort_df), pattern = 'MAP') mort_df[, which_MAP] <- round(mort_df[, which_MAP] * 365, 0) FIA_weather_by_year_bin <- mort_df use_data(FIA_weather_by_year_bin, overwrite = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.