calculate_benefit: Calculate the benefit of a hexagon from grts results.

View source: R/BASS_benefit.R

calculate_benefitR Documentation

Calculate the benefit of a hexagon from grts results.

Description

Calculate the benefit of a hexagon from grts results.

Usage

calculate_benefit(
  land_hex,
  samples,
  hex_id = hex_id,
  stratum_id = NULL,
  non_random_set = NULL,
  land_cover_weights = NULL,
  crs = 4326,
  coords = c("lon", "lat"),
  quiet = FALSE
)

Arguments

land_hex

(Spatial) Data frame. Land Cover data by hexagon. If non-spatial, will be converted to spatial sf data frame using the crs and coords arguments. Requires columns identifying the Hex ID as well as the Stratum ID (see hex_id and stratum_id respectively).

samples

(Spatial) Data frame. Results from draw_random_samples().

hex_id

Column. Identifies hexagon IDs (e.g., default hex_id).

stratum_id

Column. Identifies larger area (e.g., StudyAreaID or Province).

non_random_set

Character vector. hex_ids of hexagons to include as a non randomly selected set.

land_cover_weights

Data frame. Proportional weights (weights column) for specific types of landcover (lc column). lc should correspond to the same landcover column names as the hex data.

crs

Numeric, character, or sf/sfc. Coordinate reference system. Must be valid input to sf::st_crs().

coords

Character vector. Names of the columns containing X and Y coordinates (default c("lon", "lat")).

quiet

Logical. Whether to suppress progress messages.

Value

Spatial data frame with benefits per hex

Examples


# Using example data psu_hexagons and psu_samples

calculate_benefit(
  land_hex = psu_hexagons,
  samples = psu_samples,
  non_random_set = c("SA_09", "SA_22", "SA_47"))

# Specify a non-random set

calculate_benefit(
 land_hex = psu_hexagons,
 samples = psu_samples,
 non_random_set = c("SA_09", "SA_22", "SA_47"))

# Without GRTS

non_grts_samples <- draw_random_samples(
  land_hex = psu_hexagons,
  num_runs = 3,
  n_samples = 10,
  use_grts = FALSE)

calculate_benefit(
 land_hex = psu_hexagons,
 samples = non_grts_samples)




dhope/BASSr documentation built on April 12, 2024, 9:54 p.m.