Skip to content

Commit 6ef6d78

Browse files
committed
really fix 'match_response'
1 parent ebb5ca4 commit 6ef6d78

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

R/brmsfit-helpers.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,13 @@ match_response <- function(models) {
536536
# Args:
537537
# x, y: named lists as returned by standata
538538
to_match <- c("Y", "se", "weights", "cens", "trunc")
539-
all(ulapply(to_match, function(v)
540-
is_equal(as.vector(x[[v]])[attr(x, "old_order")],
541-
as.vector(y[[v]])[attr(y, "old_order")])))
539+
all(ulapply(to_match, function(v) {
540+
a <- if (is.null(attr(x, "old_order"))) as.vector(x[[v]])
541+
else as.vector(x[[v]])[attr(x, "old_order")]
542+
b <- if (is.null(attr(y, "old_order"))) as.vector(y[[v]])
543+
else as.vector(y[[v]])[attr(y, "old_order")]
544+
is_equal(a, b)
545+
}))
542546
}
543547
standatas <- lapply(models, standata, control = list(save_order = TRUE))
544548
matches <- ulapply(standatas[-1], .match_fun, y = standatas[[1]])

0 commit comments

Comments
 (0)