From 870e3c817f0e0dbd0295078af446b3c76862c46b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Revilla?= Date: Wed, 8 May 2024 09:47:26 +0200 Subject: [PATCH] Comment code --- R/indexing.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/indexing.R b/R/indexing.R index 75b8e7c..f6c1cf7 100644 --- a/R/indexing.R +++ b/R/indexing.R @@ -47,13 +47,13 @@ create_index4index <- function(index, name) { m <- matrix(data = NA, nrow = length(name), ncol = length(index), dimnames = list(name, names(index))) - + # Assign each row number from each batch to a position: for (batch in seq_along(index)) { positions <- sample(index[[batch]]) rows <- sample(seq_along(positions)) m[rows, batch] <- positions } - # Transform to a list format omitting the empty values + # Transform to a list omitting the empty values index_out <- apply(m, 1, function(x){x[!is.na(x)]}, simplify = FALSE) index_out[lengths(index_out) != 0] }