@@ -571,7 +571,20 @@ lagImpactMat <- function(x, reportQ=NULL) {
571
571
}
572
572
mat <- cbind(direct , indirect , total )
573
573
colnames(mat ) <- c(" Direct" , " Indirect" , " Total" )
574
- rownames(mat ) <- attr(x , " bnames" )
574
+ bnames <- attr(x , " bnames" )
575
+ have_factor_preds <- attr(x , " have_factor_preds" )
576
+ if (! is.null(have_factor_preds )) {
577
+ if (have_factor_preds ) {
578
+ xlevels <- attr(have_factor_preds , " xlevels" )
579
+ factnames <- attr(have_factor_preds , " factnames" )
580
+ rownames(mat ) <- bnames
581
+ } else {
582
+ rownames(mat ) <- bnames
583
+ }
584
+ } else {
585
+ rownames(mat ) <- bnames
586
+ }
587
+
575
588
if (! is.null(reportQ ) && reportQ ) {
576
589
if (is.null(x $ res )) {
577
590
Qobj <- attr(x , " Qres" )
@@ -586,9 +599,9 @@ lagImpactMat <- function(x, reportQ=NULL) {
586
599
Qobj $ indirect <- matrix (Qobj $ indirect , ncol = 1 )
587
600
Qobj $ total <- matrix (Qobj $ total , ncol = 1 )
588
601
}
589
- colnames(Qobj $ direct ) <- attr( x , " bnames " )
590
- colnames(Qobj $ indirect ) <- attr( x , " bnames " )
591
- colnames(Qobj $ total ) <- attr( x , " bnames " )
602
+ colnames(Qobj $ direct ) <- rownames( mat )
603
+ colnames(Qobj $ indirect ) <- rownames( mat )
604
+ colnames(Qobj $ total ) <- rownames( mat )
592
605
rownames(Qobj $ direct ) <- paste(" Q" , 1 : nrow(Qobj $ direct ), sep = " " )
593
606
rownames(Qobj $ indirect ) <- paste(" Q" , 1 : nrow(Qobj $ indirect ), sep = " " )
594
607
rownames(Qobj $ total ) <- paste(" Q" , 1 : nrow(Qobj $ total ), sep = " " )
0 commit comments