From af3ceaaa29508d2f66263b304fd098b8013665bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Revilla?= Date: Mon, 29 Apr 2024 16:49:35 +0200 Subject: [PATCH] Prevent an error --- DESCRIPTION | 2 +- R/indexing.R | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 404497a..ef06d1d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: experDesign Title: Design Experiments for Batches -Version: 0.3.0.9000 +Version: 0.3.0.9001 Authors@R: c( person("LluĂ­s", "Revilla Sancho", , "lluis.revilla@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9747-2570")), diff --git a/R/indexing.R b/R/indexing.R index 2933868..ace4b6a 100644 --- a/R/indexing.R +++ b/R/indexing.R @@ -73,6 +73,11 @@ create_index4index <- function(index, size_subset, n, name) { if (length(setdiff(pp, which(dups_out)))) { pp <- setdiff(pp, which(dups_out)) } + # Somehow sometimes there is an error with sample! + if (is.null(pp)) { + next + } + i_index <- sample(pp, 1) index_f <- c(index_f, i_index)