Learn R Programming

SemNeT (version 1.4.4)

plot.compareShiny: Plots Networks for Comparison from Shiny

Description

Uses qgraph to plot networks. Accepts any number of networks and will organize the plots in the number of side-by-side columns using the heuristic of taking the square root of the number of input and rounding down to the nearest integer (i.e., floor(sqrt(length(input)))). Performs the same operations as compare_nets

Examples

  • 3 networks: 1 x 3

  • 6 networks: 2 x 3

  • 9 networks: 3 x 3

Usage

# S3 method for compareShiny
plot(x, ...)

Value

Plots networks using qgraph

Arguments

x

Shiny result resultShiny$comparePlot

...

Additional arguments

Author

Alexander Christensen <alexpaulchristensen@gmail.com>

References

Epskamp, S., Cramer, A. O. J., Waldorp, L. J., Schmittmann, V. D., & Borsboom, D. (2012). qgraph: Network visualizations of relationships in psychometric data. Journal of Statistical Software, 48, 1-18.

Jones, P. J. (2019). networktools: Tools for Identifying Important Nodes in Networks. R package version 1.2.1.

Jones, P. J., Mair, P., & McNally, R. (2018). Visualizing psychological networks: A tutorial in R. Frontiers in Psychology, 9, 1742.

Examples

Run this code
# Simulate Datasets
one <- sim.fluency(10)
two <- sim.fluency(10)

# Compute similarity matrix
cos1 <- similarity(one, method = "cosine")
cos2 <- similarity(two, method = "cosine")

# Compute networks
net1 <- TMFG(cos1)
net2 <- TMFG(cos2)

# Compare networks
compare_nets(net1, net2, title = list("One", "Two"), config = "spring")

# Change edge colors
compare_nets(net1, net2, title = list("One", "Two"),
config = "spring", qgraph.args = list(edge.color = "blue"))

Run the code above in your browser using DataLab