Skip to content

Instantly share code, notes, and snippets.

@malcolmbarrett
Created May 7, 2019 01:25
Show Gist options
  • Save malcolmbarrett/db302c416d3f7eb1b17494ae0c2882d4 to your computer and use it in GitHub Desktop.
Save malcolmbarrett/db302c416d3f7eb1b17494ae0c2882d4 to your computer and use it in GitHub Desktop.
library(ggdag)
confounder_triangle() %>%
tidy_dagitty() %>%
dplyr::mutate(dashed = ifelse(to == "y", "dashed", "solid")) %>%
ggplot(aes(x, y, xend = xend, yend = yend)) +
geom_dag_point() +
geom_dag_text() +
geom_dag_edges_link(
aes(label = to, edge_linetype = dashed),
angle_calc = 'along',
label_dodge = unit(3, 'mm'),
arrow = NULL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment