https://smin95.github.io/ggsem/
https://smin95.github.io/ggsem/
Last synced: 13 days ago
JSON representation
- Host: GitHub
- URL: https://smin95.github.io/ggsem/
- Owner: smin95
- Created: 2024-10-18T14:46:59.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-17T02:03:31.000Z (9 months ago)
- Last Synced: 2025-10-22T04:40:25.652Z (about 2 months ago)
- Language: R
- Homepage: https://smin95.github.io/ggsem/
- Size: 44.1 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-ggplot2 - ggsem
README
ggsem: An R Package for Interactive and Reproducible Visualizations of Networks and Structural Equation Modeling Diagrams
[](https://cran.r-project.org/package=ggsem)
[](https://github.com/smin95/ggsem) [](https://CRAN.R-project.org/package=ggsem)
Author: Seung Hyun Min
**ggsem** is a web-based application and an R package, enabling users to draw path diagrams for structural equation modeling (SEM) and networks interactively using the **ggplot2** engine.
As the core of the **ggsem** package, its web app (built with **Shiny**) provides an interface that allows extensive customization, and creates CSV outputs, which can then be used to recreate the figures either using the web app or in a typical ggplot2 workflow. This will be useful to generate reproducible figures.
Unique features of this R package include options for users to draw gradient lines, gradient arrows, self-loop arrows, as well as interactively change the layout of nodes and edges.
Also, **ggsem** provides layouts of the nodes and edges from the **igraph** package for networks, understands the string input form in **laavan**'s syntax, and supports layouts from the **semPlot** package for SEM diagrams.
**Coding is optional** as users can create high-quality figures of network and SEM diagrams from start to finish within the **ggsem** application.
Nevertheless, the outputs from **ggsem** can be recreated as a raw **ggplot** output in script-based workflow, allowing users to further modify the graphical output using other packages.
The SEM diagram was created using data and a model without coding (see Chapter 6).

The two networks were separately generated from the **ggsem** app, annotated with **ggplot2** functions, and combined with **patchwork** in script-based workflow (see Chapter 4).
### Installation using RStudio
The stable version of **ggsem** can be installed using `install.packages()` from the Comprehensive R Archive Network (CRAN).
```r
install.packages(c("dplyr", "semPlot")) # Required to run ggsem app locally
install.packages("ggsem")
```
The examples on this website use the development version of the package, which can be directly downloaded using the code below:
``` r
install.packages("devtools")
devtools::install_github('smin95/ggsem')
```
### Running the ggsem App
The **ggsem** app can be initiated online using the link: https://smin95.shinyapps.io/ggsem/.
It can also be started locally in RStudio:
``` r
install.packages(c("ggsem", "dplyr", "semPlot"))
ggsem::ggsem()
```
To access an updated tutorial (sample codes and figures) of the package, please visit https://smin95.github.io/ggsem/.
### Disclosure
The creation of the package was in part inspired by this blog post: https://drsimonj.svbtle.com/ggsem-plot-sem-models-with-ggplot2.
### Issues and contact
If you find any issues with **ggsem** (both application and package), please contact me via email (seung.min\@mail.mcgill.ca).
