From ba3b273a614e5ad4d18688f35b243ef105646d8b Mon Sep 17 00:00:00 2001 From: tati-micheletti Date: Mon, 30 Oct 2023 10:49:56 +0000 Subject: [PATCH 1/3] fire sizes were not numeric. Fixed with warning --- R/makeLociList.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/makeLociList.R b/R/makeLociList.R index 3846c44..a2f14d5 100644 --- a/R/makeLociList.R +++ b/R/makeLociList.R @@ -53,6 +53,11 @@ makeLociList <- function(ras, pts, idsCol = "FIRE_ID", dateCol = "YEAR", sizeCol "m2" = 1, stop("Must provide sizeColUnits either ha or m2") ) + #Check if loci sizes are numeric, otherwise the rescaling fails + if (class(lociDF$size) != "numeric"){ + warning(paste0("Fire sizes were classified as ", class(lociDF$size),". Converting to numeric.")) + lociDF[, size := as.numeric(size)] + } set(lociDF, NULL, "size", round(lociDF$size / (prod(res(ras)) / divisor), 0)) for (index in colnames(lociDF)) { From 013292cf455a17ea0cec16328990fc2d38c7c176 Mon Sep 17 00:00:00 2001 From: tati-micheletti Date: Mon, 30 Oct 2023 11:08:34 +0000 Subject: [PATCH 2/3] Bugfix in makeLociList --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 953c87d..530ab21 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,7 @@ Type: Package Title: Utilities for Working With the 'fireSense' Group of 'SpaDES' Modules Description: Utilities for working with the 'fireSense' group of 'SpaDES' modules. Date: 2023-10-13 -Version: 0.0.5.9052 +Version: 0.0.5.9053 Authors@R: c( person("Jean", "Marchal", email = "jean.d.marchal@gmail.com", role = c("aut")), From 554389c9987d6e8e3a4b115595cc84b506f17b7c Mon Sep 17 00:00:00 2001 From: tati-micheletti Date: Mon, 30 Oct 2023 11:41:05 +0000 Subject: [PATCH 3/3] resolving CMD check note --- R/makeLociList.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/makeLociList.R b/R/makeLociList.R index a2f14d5..0e4a5f6 100644 --- a/R/makeLociList.R +++ b/R/makeLociList.R @@ -54,8 +54,8 @@ makeLociList <- function(ras, pts, idsCol = "FIRE_ID", dateCol = "YEAR", sizeCol stop("Must provide sizeColUnits either ha or m2") ) #Check if loci sizes are numeric, otherwise the rescaling fails - if (class(lociDF$size) != "numeric"){ - warning(paste0("Fire sizes were classified as ", class(lociDF$size),". Converting to numeric.")) + if (!inherits(x = lociDF$size, what = "numeric")){ + warning(paste0("Fire sizes were classified as ", class(lociDF$size),". Converting to numeric.")) lociDF[, size := as.numeric(size)] } set(lociDF, NULL, "size", round(lociDF$size / (prod(res(ras)) / divisor), 0))