I am trying to plot a ggdag plot (Directed Acyclic Graphs in R) using the wonderful ggdag package in R (https://github.com/malcolmbarrett/ggdag). Here is an example script.
library(ggdag)
library(ggplot2)
example <- ggdag::dagify(d ~ p,m ~ d,y ~ d,y ~ m)
ggdag::ggdag(example)+theme_dag()
I was wondering if there is a way to add some text on top of the arrows so that the plot looks like
Thanks!

