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 tibble: 4 x 8
##   name      x     y direction to     xend  yend circular
##   <chr> <dbl> <dbl> <fct>     <chr> <dbl> <dbl> <lgl>   
## 1 x      3.68  1.97 ->        y      4.44  1.32 FALSE   
## 2 z      4.62  2.30 ->        x      3.68  1.97 FALSE   
## 3 z      4.62  2.30 ->        y      4.44  1.32 FALSE   
## 4 y      4.44  1.32 <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!

Related

comments powered by Disqus