Commit 779e296a authored by Gjalt-Jorn Peters's avatar Gjalt-Jorn Peters

better CIM

parent 08802277
Pipeline #225570992 failed with stage
in 5 minutes and 37 seconds
......@@ -179,7 +179,7 @@ CIM <- function(data,
cfa1s = list(),
cfa2s = list(),
cfas = list(),
diamondplots = list(),
factorLoadingPlots = list(),
faDfs = list(),
scales = scales,
abbrScales = abbrScales,
......@@ -201,7 +201,7 @@ CIM <- function(data,
res$intermediate$cfa1s[[rowVar]] <- list();
res$intermediate$cfa2s[[rowVar]] <- list();
res$intermediate$cfas[[rowVar]] <- list();
res$intermediate$diamondplots[[rowVar]] <- list();
res$intermediate$factorLoadingPlots[[rowVar]] <- list();
res$intermediate$faDfs[[rowVar]] <- list();
### Get index of this row
......@@ -447,7 +447,7 @@ CIM <- function(data,
faDf <-
as.data.frame(
unclass(
res$intermediate$efas[[rowVar]][[colVar]]
res$intermediate$efas[[rowVar]][[colVar]]$loadings
)
);
......@@ -515,7 +515,7 @@ CIM <- function(data,
if (n.iter > 1) {
grobsList[[rowIndex]][[colIndex]] <-
res$intermediate$diamondplots[[rowVar]][[colVar]] <-
res$intermediate$factorLoadingPlots[[rowVar]][[colVar]] <-
factorLoadingDiamondCIplot(res$intermediate$efas[[rowVar]][[colVar]],
colors=colors,
sortAlphabetically=TRUE) +
......@@ -527,11 +527,11 @@ CIM <- function(data,
} else {
grobsList[[rowIndex]][[colIndex]] <-
res$intermediate$diamondplots[[rowVar]][[colVar]] <-
factorLoadingHeatmap(
res$intermediate$efas[[rowVar]][[colVar]],
sortAlphabetically=TRUE
);
res$intermediate$factorLoadingPlots[[rowVar]][[colVar]] <-
factorLoadingHeatmap(
res$intermediate$efas[[rowVar]][[colVar]],
sortAlphabetically=TRUE
);
}
......@@ -556,34 +556,41 @@ CIM <- function(data,
cat0("\n\n");
}
grobsList[[rowIndex]][[colIndex]] <-
gridExtra::gtable_combine(headerTable,
grobsList[[rowIndex]][[colIndex]],
along=2);
if (n.iter > 1) {
prevWidths <- grobsList[[rowIndex]][[colIndex]]$widths;
grobsList[[rowIndex]][[colIndex]] <-
gridExtra::gtable_combine(headerTable,
grobsList[[rowIndex]][[colIndex]],
along=2);
### Add variable names
titleString <-
sort(c(rowVar, colVar));
titleString <- paste0(titleString[1], ' & ', titleString[2]);
grobsList[[rowIndex]][[colIndex]] <-
gridExtra::gtable_combine(makeHeaderTable(titleString,
colSpan=6),
grobsList[[rowIndex]][[colIndex]],
along=2);
### Set widths (again, based on
### https://github.com/baptiste/gridextra/wiki/tableGrob
grobsList[[rowIndex]][[colIndex]]$widths <-
grid::unit(rep(.95 * (1/ncol(grobsList[[rowIndex]][[colIndex]])),
ncol(grobsList[[rowIndex]][[colIndex]])),
"npc");
prevWidths <- grobsList[[rowIndex]][[colIndex]]$widths;
### Add variable names
titleString <-
sort(c(rowVar, colVar));
titleString <- paste0(titleString[1], ' & ', titleString[2]);
grobsList[[rowIndex]][[colIndex]] <-
gridExtra::gtable_combine(
makeHeaderTable(
titleString,
colSpan=ncol(res$intermediate$faDfs[[colVar]][[rowVar]]$faDf_rounded)
),
grobsList[[rowIndex]][[colIndex]],
along=2
);
### Set widths (again, based on
### https://github.com/baptiste/gridextra/wiki/tableGrob
grobsList[[rowIndex]][[colIndex]]$widths <-
grid::unit(rep(.95 * (1/ncol(grobsList[[rowIndex]][[colIndex]])),
ncol(grobsList[[rowIndex]][[colIndex]])),
"npc");
}
}
}
}
### Finally, construct content; for diagonal, omega etc; for
### upper diagonal, diamondPlots; for lower diagnoal, numbers
### upper diagonal, factorLoadingPlots; for lower diagnoal, numbers
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment