ggseqplot: ggplotify sequence data plots

CRAN status R-CMD-check Codecov test coverage

The main goal of {ggseqplot} is to provide functions that reproduce the sequence plots from {TraMineR}’s seqplot using {ggplot2}. These plots are produced on the basis of state sequence objects defined with TraMineR::seqdef. The package automates the reshaping and plotting of sequence data.

Being a set of wrapper functions this library literally builds on the excellent work of the {TraMineR}, {TraMineRExtras}, and {ggplot2} developers and uses several of the their functions to produce ggplot2-flavored figures.

Note, that this library was not written because I personally dislike the plots produced by {TraMineR}, but rather because I am normally using {ggplot2} instead of base R’s plot environment for visualizing data. {TraMineR} was developed before {ggplot2} was as popular as it is today and back then many users were more familiar with coding base R plots. To date, however, many researchers and students are more accustomed to using {ggplot2} and prefer to draw on the related skills and experiences instead of learning how to refine base R plots just for the single purpose of visualizing sequence data.

{ggseqplot} contains the following functions:

If you have change requests or find errors, create an issue on github or send me an email.

A complementing vignette outlines how {ggseqplot} reshapes sequence data generated with {TraMineR} functions to visualize them using {ggplot2}. Moreover, it illustrates how to adjust the baseline output using familiar {ggplot2} functions (and add-ons).

Installation

You can install the CRAN version of {ggseqplot} by typing:

install.packages("ggseqplot")

The development version can be installed with:

devtools::install_github("maraab23/ggseqplot")

The development version (0.7.2.9000) is addressing an issue regarding the sorting order in grouped plots. In the current regular version (0.7.2), the grouped plots are always arranged in alphabetical order. The development version respects the order imposed by the user (i.e., the order of factor levels if grouping variable is a factor). Once I had the time to test the the code more extensively, I will submit the improved version to CRAN. Note that at this point, the dev version might still have some unknown issues induced by the code revision addressing the group order issue.

Acknowledgements

I want to thank like to thank Gilbert Ritschard, Tim Liao, and Emanuela Struffolino for their comments on earlier versions of this library.