Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
R-packages
ufs
Commits
779e296a
Commit
779e296a
authored
Dec 04, 2020
by
Gjalt-Jorn Peters
Browse files
better CIM
parent
08802277
Pipeline
#225570992
failed with stage
in 5 minutes and 37 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
31 deletions
+38
-31
R/CIM.R
R/CIM.R
+38
-31
No files found.
R/CIM.R
View file @
779e296a
...
@@ -179,7 +179,7 @@ CIM <- function(data,
...
@@ -179,7 +179,7 @@ CIM <- function(data,
cfa1s
=
list
(),
cfa1s
=
list
(),
cfa2s
=
list
(),
cfa2s
=
list
(),
cfas
=
list
(),
cfas
=
list
(),
diamondp
lots
=
list
(),
factorLoadingP
lots
=
list
(),
faDfs
=
list
(),
faDfs
=
list
(),
scales
=
scales
,
scales
=
scales
,
abbrScales
=
abbrScales
,
abbrScales
=
abbrScales
,
...
@@ -201,7 +201,7 @@ CIM <- function(data,
...
@@ -201,7 +201,7 @@ CIM <- function(data,
res
$
intermediate
$
cfa1s
[[
rowVar
]]
<-
list
();
res
$
intermediate
$
cfa1s
[[
rowVar
]]
<-
list
();
res
$
intermediate
$
cfa2s
[[
rowVar
]]
<-
list
();
res
$
intermediate
$
cfa2s
[[
rowVar
]]
<-
list
();
res
$
intermediate
$
cfas
[[
rowVar
]]
<-
list
();
res
$
intermediate
$
cfas
[[
rowVar
]]
<-
list
();
res
$
intermediate
$
diamondp
lots
[[
rowVar
]]
<-
list
();
res
$
intermediate
$
factorLoadingP
lots
[[
rowVar
]]
<-
list
();
res
$
intermediate
$
faDfs
[[
rowVar
]]
<-
list
();
res
$
intermediate
$
faDfs
[[
rowVar
]]
<-
list
();
### Get index of this row
### Get index of this row
...
@@ -447,7 +447,7 @@ CIM <- function(data,
...
@@ -447,7 +447,7 @@ CIM <- function(data,
faDf
<-
faDf
<-
as.data.frame
(
as.data.frame
(
unclass
(
unclass
(
res
$
intermediate
$
efas
[[
rowVar
]][[
colVar
]]
res
$
intermediate
$
efas
[[
rowVar
]][[
colVar
]]
$
loadings
)
)
);
);
...
@@ -515,7 +515,7 @@ CIM <- function(data,
...
@@ -515,7 +515,7 @@ CIM <- function(data,
if
(
n.iter
>
1
)
{
if
(
n.iter
>
1
)
{
grobsList
[[
rowIndex
]][[
colIndex
]]
<-
grobsList
[[
rowIndex
]][[
colIndex
]]
<-
res
$
intermediate
$
diamondp
lots
[[
rowVar
]][[
colVar
]]
<-
res
$
intermediate
$
factorLoadingP
lots
[[
rowVar
]][[
colVar
]]
<-
factorLoadingDiamondCIplot
(
res
$
intermediate
$
efas
[[
rowVar
]][[
colVar
]],
factorLoadingDiamondCIplot
(
res
$
intermediate
$
efas
[[
rowVar
]][[
colVar
]],
colors
=
colors
,
colors
=
colors
,
sortAlphabetically
=
TRUE
)
+
sortAlphabetically
=
TRUE
)
+
...
@@ -527,11 +527,11 @@ CIM <- function(data,
...
@@ -527,11 +527,11 @@ CIM <- function(data,
}
else
{
}
else
{
grobsList
[[
rowIndex
]][[
colIndex
]]
<-
grobsList
[[
rowIndex
]][[
colIndex
]]
<-
res
$
intermediate
$
diamondp
lots
[[
rowVar
]][[
colVar
]]
<-
res
$
intermediate
$
factorLoadingP
lots
[[
rowVar
]][[
colVar
]]
<-
factorLoadingHeatmap
(
factorLoadingHeatmap
(
res
$
intermediate
$
efas
[[
rowVar
]][[
colVar
]],
res
$
intermediate
$
efas
[[
rowVar
]][[
colVar
]],
sortAlphabetically
=
TRUE
sortAlphabetically
=
TRUE
);
);
}
}
...
@@ -556,34 +556,41 @@ CIM <- function(data,
...
@@ -556,34 +556,41 @@ CIM <- function(data,
cat0
(
"\n\n"
);
cat0
(
"\n\n"
);
}
}
grobsList
[[
rowIndex
]][[
colIndex
]]
<-
if
(
n.iter
>
1
)
{
gridExtra
::
gtable_combine
(
headerTable
,
grobsList
[[
rowIndex
]][[
colIndex
]],
along
=
2
);
prevWidths
<-
grobsList
[[
rowIndex
]][[
colIndex
]]
$
widths
;
grobsList
[[
rowIndex
]][[
colIndex
]]
<-
gridExtra
::
gtable_combine
(
headerTable
,
grobsList
[[
rowIndex
]][[
colIndex
]],
along
=
2
);
### Add variable names
prevWidths
<-
grobsList
[[
rowIndex
]][[
colIndex
]]
$
widths
;
titleString
<-
sort
(
c
(
rowVar
,
colVar
));
### Add variable names
titleString
<-
paste0
(
titleString
[
1
],
' & '
,
titleString
[
2
]);
titleString
<-
grobsList
[[
rowIndex
]][[
colIndex
]]
<-
sort
(
c
(
rowVar
,
colVar
));
gridExtra
::
gtable_combine
(
makeHeaderTable
(
titleString
,
titleString
<-
paste0
(
titleString
[
1
],
' & '
,
titleString
[
2
]);
colSpan
=
6
),
grobsList
[[
rowIndex
]][[
colIndex
]]
<-
grobsList
[[
rowIndex
]][[
colIndex
]],
gridExtra
::
gtable_combine
(
along
=
2
);
makeHeaderTable
(
titleString
,
### Set widths (again, based on
colSpan
=
ncol
(
res
$
intermediate
$
faDfs
[[
colVar
]][[
rowVar
]]
$
faDf_rounded
)
### https://github.com/baptiste/gridextra/wiki/tableGrob
),
grobsList
[[
rowIndex
]][[
colIndex
]]
$
widths
<-
grobsList
[[
rowIndex
]][[
colIndex
]],
grid
::
unit
(
rep
(
.95
*
(
1
/
ncol
(
grobsList
[[
rowIndex
]][[
colIndex
]])),
along
=
2
ncol
(
grobsList
[[
rowIndex
]][[
colIndex
]])),
);
"npc"
);
### 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
### Finally, construct content; for diagonal, omega etc; for
### upper diagonal,
diamond
Plots; for lower diagnoal, numbers
### upper diagonal,
factorLoading
Plots; for lower diagnoal, numbers
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment