Calculate the NatureServe Climate Change Vulnerability Index from the completed inputs.
calc_vulnerability(spat_df, vuln_df, tax_grp, n_rnds = 1000)
data.frame of spatial inputs produced by analyze_spatial
data.frame of answers to vulnerability questions. The format
must match make_vuln_df
.
taxonomic group of the species. Must match one of the options below
number of Monte Carlo repetitions for determining variability when multiple values are given for a factor
A data.frame with 1 row per scenario and columns:
Name identifying the scenario
The index value as a string. EV: Extremely Vulnerable, HV: Highly Vulnerable, MV: Moderately Vulnerable, LV: Less Vulnerable, IE: Insufficient Evidence
An index of the confidence in the index based on the monte carlo. Options are Low, Moderate, High, Very High or Insufficient Evidence.
A data.frame with the b_c_score, d_score, and index for each monte carlo repitition
An index of the migratory exposure. Options are Low, Moderate, High, or "N/A"
Total score from section D the modelled response to climate change section
Total score from sections B and C the indirect exposure, sensitivity and adaptive capacity sections
Answers to each question plus any comments. Numerical scores correspond to: -1) Unknown, 0) Neutral, 1) Somewhat increase, 2) Increase, 3) Greatly increase. If there are 2 numbers then two boxes were checked and the average of the scores was used in the total score
Number of factors scored in section B
Number of factors scored in section C
Number of factors scored in section D
Whether the species' vulnerability to sea level rise and dispersal limitations led to an index of EV
Options for tax_grp
are Vascular Plant, Nonvascular Plant, Lichen,
Invert-Insect, Invert-Mollusk, Invert-Other, Fish, Amphibian, Reptile,
Mammal, Bird
base_pth <- system.file("extdata", package = "ccviR")
# scenario names
scn_nms <- c("RCP 4.5", "RCP 8.5")
clim_vars <- get_clim_vars(file.path(base_pth, "clim_files/processed"),
scenario_names = scn_nms)
spat_res <- analyze_spatial(
range_poly = sf::read_sf(file.path(base_pth, "rng_poly.shp"), agr = "constant"),
scale_poly = sf::read_sf(file.path(base_pth, "assess_poly.shp"), agr = "constant"),
clim_vars_lst = clim_vars,
hs_rast = terra::rast(c(file.path(base_pth, "rng_chg_45.tif"),
file.path(base_pth, "rng_chg_85.tif"))),
hs_rcl = matrix(c(-1, 0, 1, 1, 2, 3), ncol = 2),
scenario_names = scn_nms
)
#> performing spatial analysis
#> Warning: More than 10% of the range change raster does not match the expected values.
#> Is the classification table correct?
# vulnerability factor table with score 1 (somewhat increase vulnerability)
# for all factors
vuln <- make_vuln_df("test_species", val1 = 1, mig = 1)
calc_vulnerability(spat_res$spat_table, vuln, "Bird")
#> calculating vulnerability index RCP 4.5
#> finished vulnerability
#> calculating vulnerability index RCP 8.5
#> finished vulnerability
#> # A tibble: 2 × 12
#> scenario_name index conf_index mc_results mig_exp d_score b_c_score vuln_df
#> <chr> <chr> <chr> <list> <chr> <dbl> <dbl> <list>
#> 1 RCP 4.5 EV Very High <df [1 × 3]> N/A 6 25.1 <tibble>
#> 2 RCP 8.5 EV Very High <df [1 × 3]> N/A 6 31.9 <tibble>
#> # ℹ 4 more variables: n_b_factors <int>, n_c_factors <int>, n_d_factors <int>,
#> # slr_vuln <lgl>