Learn R Programming

MplusLGM (version 1.0.0)

getSpaghetti: Plot individual trajectories of outcome - Spaghetti plot

Description

Generate a spaghetti plot to visualize the individual trajectories of a given outcome across time..

Usage

getSpaghetti(data, outvar)

Value

A ggplot object displaying the spaghetti plot of individual trajectories.

Arguments

data

A data frame containing all variables for the trajectory analysis.

outvar

A character vector specifying the outcome variables at different times.

Examples

Run this code
# Example usage:
plot <- getSpaghetti(
  data = symptoms,
  outvar = paste("sx", seq(from = 0, to = 24, by = 6), sep = "_"))

print(plot)

Run the code above in your browser using DataLab