I recently read an article in the New York Times about excess deaths in Sweden during the coronavirus outbreak. As opposed to many of its neighbors, Sweden did not do a general lockdown; instead, it (controversially) strove to systematically develop herd immunity. However, current data suggest that excess deaths (the number of deaths above the usual number) in Sweden are higher than many of its neighbors that enacted early, stricter lockdowns.
I’m pleased to announce that ggdag 0.2.0 is now on CRAN! ggdag links the dagitty package, which contains powerful algorithms for analyzing causal DAGs, with the unlimited flexibility of ggplot2. ggdag coverts dagitty objects to a tidy DAG data structure, which allows you to both analyze your DAG and plot it easily in ggplot2. Let’s look at an example for a causal diagram of the effect of smoking on cardiac arrest.
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.