Skip to content

Commit

Permalink
Comment code
Browse files Browse the repository at this point in the history
  • Loading branch information
llrs committed May 8, 2024
1 parent 27fa2b0 commit 870e3c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/indexing.R
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down

0 comments on commit 870e3c8

Please sign in to comment.