diff --git a/NEWS b/NEWS index 0f69970..33bec4b 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -akgfmaps 3.5.4 (September 18, 2024) +akgfmaps 3.5.4 (September 23, 2024) ---------------------------------------------------------------- BUG FIX diff --git a/R/make_idw_map.R b/R/make_idw_map.R index 8291479..d2dcdf0 100644 --- a/R/make_idw_map.R +++ b/R/make_idw_map.R @@ -199,11 +199,23 @@ make_idw_map <- function(x = NA, vec <- sub("\\,", "–", vec) vec <- sub("\\]", "", vec) - if(length(sig.dig) > 3) { - - sig.dig.format <- trimws(format(sort(sig.dig, decreasing = TRUE), nsmall=0, big.mark=",")) - - sig.dig.desc <- trimws(format(sort(sig.dig, decreasing = TRUE))) + if(length(sig.dig) > 0) { + + sig.dig.format <- trimws( + format( + sort(sig.dig, + decreasing = TRUE), + scientific = FALSE, + nsmall=0, + big.mark=",") + ) + + sig.dig.desc <- trimws( + format( + sort(sig.dig, + decreasing = TRUE), + scientific = FALSE) + ) for(j in 1:length(sig.dig)) { vec <- sub(pattern = sig.dig.desc[j], replacement = sig.dig.format[j], x = vec) diff --git a/R/make_idw_stack.R b/R/make_idw_stack.R index f1df14c..6ec1b1a 100644 --- a/R/make_idw_stack.R +++ b/R/make_idw_stack.R @@ -197,14 +197,28 @@ make_idw_stack <- function(x = NA, vec <- sub("\\,", "–", vec) vec <- sub("\\]", "", vec) - if(length(sig.dig) > 3) { - - sig.dig.format <- trimws(format(sort(sig.dig, decreasing = TRUE), nsmall=0, big.mark=",")) - - sig.dig.desc <- trimws(format(sort(sig.dig, decreasing = TRUE))) + if(length(sig.dig) > 0) { + + sig.dig.format <- trimws( + format( + sort(sig.dig, + decreasing = TRUE), + scientific = FALSE, + nsmall=0, + big.mark=",") + ) + + sig.dig.desc <- trimws( + format( + sort(sig.dig, + decreasing = TRUE), + scientific = FALSE) + ) for(j in 1:length(sig.dig)) { - vec <- sub(pattern = sig.dig.desc[j], replacement = sig.dig.format[j], x = vec) + vec <- sub(pattern = sig.dig.desc[j], + replacement = sig.dig.format[j], + x = vec) } } return(vec)