From f714a61e517372ff6c76c07191c1b5806bc59d5a Mon Sep 17 00:00:00 2001 From: mhesselbarth Date: Thu, 30 Nov 2023 15:53:20 +0100 Subject: [PATCH] :bug: Fix #310 --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ R/lsm_c_clumpy.R | 2 +- cran-comments.md | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5445e86ab..d5e823661 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: landscapemetrics Title: Landscape Metrics for Categorical Map Patterns -Version: 2.1.0 +Version: 2.1.1 Authors@R: c(person("Maximilian H.K.", "Hesselbarth", role = c("aut", "cre"), email = "mhk.hesselbarth@gmail.com", diff --git a/NEWS.md b/NEWS.md index b74ac25d4..7927551e4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# landscapemetrics 2.1.0 +* Bugfixes + * Bugfix in calculate of clumpy if NA calc is present + # landscapemetrics 2.1.0 * Improvements * Many performance improvements. Most visible are in diff --git a/R/lsm_c_clumpy.R b/R/lsm_c_clumpy.R index 7ccb9dc64..4e4a44d37 100644 --- a/R/lsm_c_clumpy.R +++ b/R/lsm_c_clumpy.R @@ -105,7 +105,7 @@ lsm_c_clumpy_calc <- function(landscape, resolution, extras = NULL){ clumpy <- vapply(seq_along(g_i), FUN = function(i) { # set to NA if mathematical not possible - if (is.nan(g_i[i]) || is.na(g_i[i]) || p_i[i] == 1) numeric(NA) + if (is.nan(g_i[i]) || is.na(g_i[i]) || p_i[i] == 1) as.numeric(NA) # calc clumpy else if (g_i[i] >= p_i[i]) (g_i[i] - p_i[i]) / (1 - p_i[i]) else if (g_i[i] < p_i[i] && p_i[i] >= 0.5) (g_i[i] - p_i[i]) / (1 - p_i[i]) diff --git a/cran-comments.md b/cran-comments.md index 1871f47ce..10e67e2c3 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,3 +1,6 @@ +# landscapemetrics 2.1.1 +Minor bugfix + # landscapemetrics 2.1.0 Larger internal updates to several algorithms