Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cjvanlissa
committed
Apr 12, 2022
1 parent
8c530b7
commit 240ba29
Showing
6 changed files
with
73 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
library(lavaan) | ||
res <- sem("dist ~ speed", cars, meanstructure =T) | ||
|
||
|
||
# graph_sem(res) | ||
# lay <- get_layout("dist", "speed", rows = 1) | ||
# graph_sem(res, | ||
# layout = lay, # layout | ||
# label = "est_std", # get standardized results (not rounded) | ||
# angle = 170 # adjust the arrows | ||
# ) | ||
# | ||
# graph_sem(res, | ||
# layout = lay, # layout | ||
# nodes = get_nodes(res, label = "name"), | ||
# edges = get_edges(res, label = "est_std"), | ||
# angle = 170 # adjust the arrows | ||
# ) | ||
|
||
test_that("prepare_graph handles label argument", { | ||
tmp <- prepare_graph(res, label = "est_std") | ||
expect_true(all(!is.na(as.numeric(tmp$edges$label)))) | ||
expect_true(all(!is.na(as.numeric(tmp$nodes$label)))) | ||
}) | ||
|
||
test_that("prepare_graph handles expression in label argument", { | ||
tmp <- prepare_graph(res, label = paste2(lhs, est_sig, sep = "\n")) | ||
expect_true(any(startsWith(tmp$edges$label, "dist"))) | ||
expect_true(any(startsWith(tmp$nodes$label, "dist"))) | ||
}) | ||
|
||
test_that("graph_sem handles label argument", { | ||
tmp <- graph_sem(res, label = "est_std") | ||
expect_true(all(!is.na(as.numeric(tmp$layers[[3]]$data$label)))) | ||
expect_true(all(!is.na(as.numeric(tmp$layers[[5]]$data$label)))) | ||
}) | ||
|
||
test_that("graph_sem handles expression in label argument", { | ||
tmp <- graph_sem(res, label = paste2(lhs, est_sig, sep = "\n")) | ||
expect_true(any(startsWith(tmp$layers[[3]]$data$label, "dist"))) | ||
expect_true(any(startsWith(tmp$layers[[5]]$data$label, "dist"))) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters