Skip to content

Commit

Permalink
add preallocate list
Browse files Browse the repository at this point in the history
  • Loading branch information
shazanfar committed Aug 1, 2024
1 parent 54bbfb4 commit 0442367
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/classifyEmbedding.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#' that each row of the training set.
#'
#' @examples
#' set.seed(100)
#' # Simulate coordinates
#' coords <- matrix(rnorm(1000), 100, 10)
#' rownames(coords) <- paste0("cell_", 1:nrow(coords))
Expand Down Expand Up @@ -128,7 +129,7 @@ classifyEmbedding <- function(
return(out)
}

E_list <- list()
E_list <- vector("list", length = adaptive_nRep)

for (Rep in seq_len(adaptive_nRep)) {
train_k <- sample(seq_len(adaptive_nFold), nrow(coords_train),
Expand All @@ -155,7 +156,7 @@ classifyEmbedding <- function(
class_true = labels_test
)

E_list[[length(E_list) + 1]] <- E
E_list[[Rep]] <- E
}
}
E <- combineBinaryErrors(E_list)[rownames(coords_train), ]
Expand Down
1 change: 1 addition & 0 deletions man/classifyEmbedding.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0442367

Please sign in to comment.