explore_blocks_pre: Explore potential hierarchical blocks before sampling or...

View source: R/explore_blocks.R

explore_blocks_preR Documentation

Explore potential hierarchical blocks before sampling or spatial stratification

Description

Function to explore the number of cases and observations for the different sampling units possibly used as the base H0 hierarchical level, such as population ID, study area, animal ID, or year, before spatial stratification or creating samples for the bootstrapped approach. The function can help understand how imbalanced is the data across H0 levels used for validation.

Usage

explore_blocks_pre(data, colH0, animal_id = NULL, col_case = "case")

Arguments

data

⁠[data.frame,tibble]⁠
Complete data set to be analyzed.

colH0

⁠[character]⁠
Name of the column in data to be used as the H0 hierarchical level, intended for model validation.

animal_id

⁠[character]⁠
Name of the column in data representing animal ID. If NULL (default), summaries are not created for individuals.

col_case

⁠[string(1)="case"]⁠
Name of the column in data representing the case or used/available points. Default is "case".

Examples

# read data
data("reindeer_ssf")

# explore blocks - animal ID as block H0
explore_blocks_pre(reindeer_ssf, "original_animal_id", col_case = "case_")

# explore blocks - year as block H0
library(lubridate)
reindeer_ssf |>
  dplyr::mutate(year = lubridate::year(t1_)) |>
  explore_blocks_pre("year", col_case = "case_")

# year as block H0 + animal ID
reindeer_ssf |>
  dplyr::mutate(year = lubridate::year(t1_)) |>
  explore_blocks_pre("year", animal_id = "original_animal_id", col_case = "case_")

NINAnor/oneimpact documentation built on June 14, 2025, 12:27 a.m.