@@ -273,10 +273,9 @@ impacts.SlX <- function(obj, ...) {
273273 n <- nrow(obj $ model )
274274 k <- obj $ qr $ rank
275275 impactsWX(attr(obj , " mixedImps" ), n , k , type = " SlX" , method = " glht" ,
276- have_factor_preds = attr(obj , " have_factor_preds" ))
276+ have_factor_preds = attr(obj , " have_factor_preds" ))
277277}
278278
279-
280279impactsWX <- function (obj , n , k , type = " SlX" , method = " glht" , have_factor_preds = FALSE ) {
281280 imps <- lapply(obj , function (x ) x [, 1 ])
282281 bnames <- rownames(obj [[1 ]])
@@ -297,25 +296,37 @@ impactsWX <- function(obj, n, k, type="SlX", method="glht", have_factor_preds=FA
297296}
298297
299298update_bnames <- function (bnames , have_factor_preds = FALSE ) {
300- interactions <- length(grep(" :" , bnames )) > 0L
301299 b_suffix <- rep(" dy/dx" , length(bnames ))
302- if (have_factor_preds && ! interactions ) {
300+ stopifnot(! is.null(have_factor_preds ))
301+ if (have_factor_preds ) {
303302 factnames <- attr(have_factor_preds , " factnames" )
304- xlevels <- attr(have_factor_preds , " xlevels" )
305- contrasts <- attr(have_factor_preds , " contrasts" )
306303 for (pred in seq(along = factnames )) {
307- npred <- grep(factnames [pred ], bnames )
308- xlpred <- xlevels [[pred ]]
309- cpred <- contrasts [[pred ]]
310- if (length(npred ) == length(xlpred )) {
311- b_suffix [npred ] <- xlpred
312- } else {
313- switch (cpred ,
314- contr.treatment = ,
315- code_control = ,
316- code_diff =
317- )
318- }
304+ npred <- grep(paste0(" ^" , factnames [pred ], " .*" ), bnames )
305+ b_suffix [npred ] <- " (F)"
306+ # =======
307+ # xlevels <- attr(have_factor_preds, "xlevels")
308+ # contrasts <- attr(have_factor_preds, "pred_contrasts")
309+ # for (pred in seq(along=factnames)) {
310+ # npred <- grep(factnames[pred], bnames)
311+ # xlpred <- xlevels[[pred]]
312+ # cpred <- contrasts[[pred]]
313+ # if (length(npred) >= length(xlpred)) {
314+ # b_suffix[npred] <- ""
315+ # } else {
316+ # if (cpred == "contr.treatment") {
317+ # b_suffix[npred] <- xlpred[-1]
318+ # } else if (cpred == "code_control") {
319+ # b_suffix[npred] <- paste(xlpred[-1], "vs.", xlpred[1])
320+ # } else if (cpred == "code_diff") {
321+ # b_suffix[npred] <- paste(xlpred[-1], "vs.",
322+ # xlpred[-length(xlpred)])
323+ # } else if (cpred == "contr.poly") {
324+ # b_suffix[npred] <- "poly"
325+ # } else {
326+ # b_suffix[npred] <- ""
327+ # }
328+ # }
329+ # >>>>>>> ddd1e233b0387bd18bd409837b00671295e6001d
319330 }
320331 }
321332 bnames <- paste(bnames , b_suffix )
0 commit comments