From 42b9004f73702d9f0d29eb2de45fbd397215d34b Mon Sep 17 00:00:00 2001 From: "Ben B. Hansen" Date: Fri, 8 Nov 2024 04:30:50 +0100 Subject: [PATCH] Another aggregateDesigns() ordering adjustment On second thought, what was intended was something like this. Cf. #138 --- R/Design.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/Design.R b/R/Design.R index 4af6422..97fa90d 100644 --- a/R/Design.R +++ b/R/Design.R @@ -694,10 +694,10 @@ aggregateDesigns <- function(design) { # To align w/ this `C_transp`, everything to be returned # needs to align w/ `levels(Cluster)`, not with # `Cluster` itself. So, - Z <- Z[levels(Cluster)] - StrataFrame <- - StrataFrame[match(levels(Cluster), as.character(Cluster)), - , drop=FALSE] + cperm <- match(levels(Cluster), as.character(Cluster)) + Z <- Z[cperm] + StrataFrame <- StrataFrame[cperm, , drop=FALSE] + Cluster <- Cluster[cperm] unit.weights <- as.matrix(C_transp %*% as.matrix(design@UnitWeights))