Skip to content

Commit

Permalink
fix #91 - handle no actieve haarden vespa velutina
Browse files Browse the repository at this point in the history
  • Loading branch information
mvarewyck committed Apr 12, 2024
1 parent c8a43f0 commit 0933597
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions alienSpecies/R/mapHeat.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@
#' @export
combineActiveData <- function(activeData, untreatedData, managedData = NULL) {

activeData$type <- "individual"
untreatedData$type <- "untreated nest"

if (nrow(activeData) != 0) {

activeData$type <- "individual"
# for intermediate data (no radius yet)
if (is.null(activeData$radius))
activeData$radius <- NA

}

untreatedData$type <- "untreated nest"
# for intermediate data (no radius yet)
if (is.null(activeData$radius))
activeData$radius <- NA
if (is.null(untreatedData$radius))
untreatedData$radius <- NA

Expand All @@ -29,7 +35,8 @@ combineActiveData <- function(activeData, untreatedData, managedData = NULL) {


toReturn <- rbind(
activeData[, c("type", "popup", "radius")],
if (nrow(activeData) != 0)
activeData[, c("type", "popup", "radius")],
if (!is.null(managedData))
managedData[, c("type", "popup", "radius")],
untreatedData[, c("type", "popup", "radius")]
Expand Down Expand Up @@ -218,7 +225,7 @@ mapHeatServer <- function(id, uiText, species, gewest, combinedData, filter, col
decodeText(
text = tmpTranslation()$description,
params = list(
maxDate = format(maxDate(), "%d/%m/%Y"),
maxDate = tryCatch(format(maxDate(), "%d/%m/%Y"), error = function(e) NA),
maxYear = format(Sys.Date(), "%Y")
)
)
Expand Down

0 comments on commit 0933597

Please sign in to comment.