From f406b70adc9aaeb93aae5487aebf5abc4c22c507 Mon Sep 17 00:00:00 2001 From: Jason Everett Date: Mon, 24 Nov 2025 21:58:19 +1100 Subject: [PATCH 1/8] Fix errors with checks --- .github/workflows/MacOS.yaml | 1 + .github/workflows/Ubuntu.yaml | 1 + .github/workflows/Windows.yaml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/MacOS.yaml b/.github/workflows/MacOS.yaml index eeb6db9..f44ef01 100644 --- a/.github/workflows/MacOS.yaml +++ b/.github/workflows/MacOS.yaml @@ -46,6 +46,7 @@ jobs: any::rcmdcheck any::remotes any::lpsymphony + any::slam needs: check - uses: r-lib/actions/check-r-package@v2 diff --git a/.github/workflows/Ubuntu.yaml b/.github/workflows/Ubuntu.yaml index 03878a2..562a505 100644 --- a/.github/workflows/Ubuntu.yaml +++ b/.github/workflows/Ubuntu.yaml @@ -53,6 +53,7 @@ jobs: any::rcmdcheck any::remotes any::lpsymphony + any::slam needs: check - uses: r-lib/actions/check-r-package@v2 diff --git a/.github/workflows/Windows.yaml b/.github/workflows/Windows.yaml index e46efd1..76154cf 100644 --- a/.github/workflows/Windows.yaml +++ b/.github/workflows/Windows.yaml @@ -50,6 +50,7 @@ jobs: any::rcmdcheck any::remotes any::lpsymphony + any::slam needs: check - uses: r-lib/actions/check-r-package@v2 From 48a6bd797ff2036ddf434733bed4a70483f49085 Mon Sep 17 00:00:00 2001 From: Jason Everett Date: Tue, 25 Nov 2025 08:03:53 +1100 Subject: [PATCH 2/8] Website updates --- R/minpatch.R | 12 +++++++----- README.Rmd | 1 - README.md | 1 - docs/articles/minpatch.html | 12 +++--------- docs/articles/minpatch.md | 3 --- docs/articles/minpatchTasmania.html | 9 +++------ docs/articles/minpatchTasmania.md | 3 --- docs/pkgdown.yml | 2 +- man/minpatch-package.Rd | 4 ++-- vignettes/minpatch.Rmd | 6 ------ vignettes/minpatchTasmania.Rmd | 8 -------- 11 files changed, 16 insertions(+), 45 deletions(-) diff --git a/R/minpatch.R b/R/minpatch.R index 0c73372..3a541cc 100644 --- a/R/minpatch.R +++ b/R/minpatch.R @@ -99,6 +99,8 @@ run_minpatch <- function(prioritizr_problem, solution_column = "solution_1", verbose = TRUE) { + # Stage 0: Checks and data preparation ----- + # Check if prioritizr is available if (!requireNamespace("prioritizr", quietly = TRUE)) { stop("prioritizr package is required for this function") @@ -206,7 +208,9 @@ run_minpatch <- function(prioritizr_problem, minpatch_data <- calculate_patch_stats(minpatch_data) initial_patch_stats <- minpatch_data$patch_stats - # Stage 1: Remove small patches (conditional) + + + # Stage 1: Remove small patches (conditional) ----- if (remove_small_patches) { if (verbose) cat("Stage 1: Removing small patches...\n") minpatch_data <- remove_small_patches_from_solution(minpatch_data) @@ -231,15 +235,13 @@ run_minpatch <- function(prioritizr_problem, minpatch_data$prioritizr_solution$minpatch <- create_solution_vector(minpatch_data$unit_dict) } - # Stage 2: Add new patches to meet targets (conditional) + # Stage 2: Add new patches to meet targets (conditional) ---- unmet_targets <- character(0) if (add_patches) { if (verbose) cat("Stage 2: Adding new patches...\n") - minpatch_data <- add_new_patches(minpatch_data, verbose) - # Check final unmet targets unmet_targets <- identify_unmet_targets(minpatch_data) @@ -253,7 +255,7 @@ run_minpatch <- function(prioritizr_problem, if (verbose) cat("Stage 2: Skipping addition of new patches...\n") } - # Stage 3: Simulated whittling (conditional) + # Stage 3: Simulated whittling (conditional) ---- if (whittle_patches) { if (verbose) cat("Stage 3: Removing unnecessary planning units...\n") minpatch_data <- simulated_whittling(minpatch_data, verbose) diff --git a/README.Rmd b/README.Rmd index 9d36e6f..d1555cc 100644 --- a/README.Rmd +++ b/README.Rmd @@ -66,7 +66,6 @@ pak::pak("SpatialPlanning/minpatch") - **Flexible Parameters**: Control minimum patch sizes, patch radius, and boundary penalties - **Comprehensive Reporting**: Detailed statistics and comparisons - **Visualization Support**: Plot results with ggplot2 (optional) -- **Well Documented**: Extensive documentation and examples ## Algorithm Details diff --git a/README.md b/README.md index 8611a54..281fe26 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,6 @@ pak::pak("SpatialPlanning/minpatch") and boundary penalties - **Comprehensive Reporting**: Detailed statistics and comparisons - **Visualization Support**: Plot results with ggplot2 (optional) -- **Well Documented**: Extensive documentation and examples ## Algorithm Details diff --git a/docs/articles/minpatch.html b/docs/articles/minpatch.html index 442c63f..5b2685c 100644 --- a/docs/articles/minpatch.html +++ b/docs/articles/minpatch.html @@ -57,10 +57,7 @@