diff --git a/R/ranger.R b/R/ranger.R index c33da627..6d56d4d4 100644 --- a/R/ranger.R +++ b/R/ranger.R @@ -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.") }