Package 'lavaangui'

Title: Graphical User Interface with Integrated 'Diagrammer' for 'Lavaan'
Description: Provides a graphical user interface with an integrated diagrammer for latent variables from the 'lavaan' package. It offers two core functions: first, lavaangui() launches a web application that allows users to specify models by drawing path diagrams, fitting them, assessing model fit, and more; second, plot_interactive() creates interactive path diagrams from models specified in 'lavaan'. Karch (2024) <doi: 10.31234/osf.io/f4ary> contains a tutorial.
Authors: Julian D. Karch [aut, cre, cph]
Maintainer: Julian D. Karch <[email protected]>
License: GPL (>= 3)
Version: 0.1.2
Built: 2024-11-12 04:56:44 UTC
Source: https://github.com/karchjd/lavaangui

Help Index


Start lavaangui Shiny Application

Description

The lavaangui function launches the lavaangui Shiny application.

Usage

lavaangui(fit = NULL)

Arguments

fit

A lavaan model, as returned by the lavaan, sem, or cfa functions from the lavaan package. If provided, lavaangui imports the model and data. If left empty, lavaangui starts without importing.

Details

Currently, multiple-group models are not supported. However, you can create an interactive plot of those models using plot_interactive

Value

nothing

Examples

# Without importing lavaan model
lavaangui()

# Importing a lavaan model
library(lavaan)
model <- ' 
  visual  =~ x1 + loadingx2*x2 + x3
  textual =~ x4 + x5 + x6
  speed   =~ x7 + x8 + x9
'
fit <- cfa(model, data = HolzingerSwineford1939)
lavaangui(fit)

Create Interactive Path Diagrams for Lavaan Models

Description

The plot_interactive function creates path diagrams for lavaan model. The created paths diagrams are interactive. That is, their appearance can be customized easily, for example, by dragging around nodes representing variable with the mouse.

Usage

plot_interactive(fit, where = "gadget")

Arguments

fit

A lavaan model, as returned by the functions lavaan, sem, or cfa from the lavaan package.

where

A character string to specify where the path diagram should be shown. The default value "gadget" shows it directly in Rstudio. For "browser", it's shown in your default browser. For non-RStudio users, the parameter has no effect, and the path diagram is always shown in the browser.

Value

nothing

Examples

library(lavaan)
model <- ' 
  visual  =~ x1 + loadingx2*x2 + x3
  textual =~ x4 + x5 + x6
  speed   =~ x7 + x8 + x9
'
fit <- cfa(model, data = HolzingerSwineford1939)
plot_interactive(fit)