From ff8aa487caa5b46bcb7f3eeb1ba97cfa173f640c Mon Sep 17 00:00:00 2001 From: ARIADNA BATALLA FERRES Date: Fri, 20 Sep 2024 16:31:25 +0200 Subject: [PATCH] Add mask updates to VizRobinson.R --- R/VizRobinson.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/VizRobinson.R b/R/VizRobinson.R index 2e00161..63f5c7f 100644 --- a/R/VizRobinson.R +++ b/R/VizRobinson.R @@ -246,12 +246,14 @@ VizRobinson <- function(data, lon, lat, lon_dim = NULL, lat_dim = NULL, if (!identical(dim(mask), dim(data))) { stop("Parameter 'mask' must have the same dimensions as 'data'.") } else if (is.numeric(mask)) { + mask[which(is.na(mask))] <- 0 if (all(mask %in% c(0, 1))) { mask <- array(as.logical(mask), dim = dim(mask)) } else { stop("Parameter 'mask' must have only TRUE/FALSE or 0/1.") } } else if (is.logical(mask)) { + mask[which(is.na(mask))] <- F if (!all(mask %in% c(T, F))) { stop("Parameter 'mask' must have only TRUE/FALSE or 0/1.") } -- GitLab