ggdag 0.1.0

I’m pleased to announce the release of ggdag 0.1.0 on CRAN! ggdag uses the powerful dagitty package to create and analyze structural causal models and plot them using ggplot2 and ggraph in a tidy, consistent, and easy manner. You can use dagitty objects directly in ggdag, but ggdag also includes wrappers to make DAGs using a more R-like syntax:

# install.packages("ggdag")
library(ggdag)

dag <- dagify(y ~ x + z,
       x ~ z) %>% 
  tidy_dagitty()

dag
## # A DAG with 3 nodes and 3 edges
## #
## # A tibble: 4 x 8
##   name      x     y direction to     xend  yend circular
##   <chr> <dbl> <dbl> <fct>     <chr> <dbl> <dbl> <lgl>   
## 1 x      6.14  2.04 ->        y      5.18  1.75 FALSE   
## 2 z      5.92  1.06 ->        x      6.14  2.04 FALSE   
## 3 z      5.92  1.06 ->        y      5.18  1.75 FALSE   
## 4 y      5.18  1.75 <NA>      <NA>  NA    NA    FALSE
ggdag(dag)

You can learn more about it on the ggdag website, a pkgdown site that includes rendered documentation and the following vignettes:

Give it a try, and please file an bugs or suggestions to the GitHub repo.

I also want to thank a few of my fellow USC PhDs, David Bogumil, Ugonna Ihenacho, and Zhi Yang, for helping me polish the articles and offering helpful suggestions on some of the aesthetic details of ggdag. Thanks, y’all!

Avatar
Malcolm Barrett
PhD Student in Epidemiology

I am an R developer and a PhD student in Epidemiology at the University of Southern California. My work in public health has spanned on-ground clinical education and research for clinical and cohort studies. Previously, I was an intern at RStudio, and I served two years in AmeriCorps at federally-qualified health centers in Michigan and New York City.