Skip to content

Commit

Permalink
Merge pull request #710 from imbs-hl/issue709
Browse files Browse the repository at this point in the history
Add check for inbag element size
  • Loading branch information
mnwright authored Nov 22, 2023
2 parents dcaee8d + b9792f2 commit 24a24bf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/ranger.R
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,9 @@ ranger <- function(formula = NULL, data = NULL, num.trees = 500, mtry = NULL,
if (length(inbag) != num.trees) {
stop("Error: Size of inbag list not equal to number of trees.")
}
if (any(sapply(inbag, length) != nrow(x))) {
stop("Error: Size of at least one element in inbag not equal to number of samples.")
}
} else {
stop("Error: Invalid inbag, expects list of vectors of size num.trees.")
}
Expand Down

0 comments on commit 24a24bf

Please sign in to comment.