I need to create a plot displaying the associations among 3 categorical variables, let's call them exposure, mediator, and outcome.
I want a line to go from +1 of the exposures to +1 of the mediators and another line to go from +1 of the mediators to +1 of the outcomes. There are 4 exposures, 55 mediators, and 5 outcomes. Not all of them are associated with each other, so not all of them will have connecting lines.
If you are familiar with epidemiology, I simply want to show which mediators intersect the relationship between some of the exposures and outcomes.
Here is the head() of my dataset. I only want lines for those with p-value<0.05.
> head(stackoverflow) metabolite exposure1_p exposure2_p exposure3_p exposure4_p outcome1_p outcome2_p outcome3_p outcome4_p outcome5_p 55 Pro Lys 0.231338154 0.51026651 0.682634745 2.61721e-04 0.374728778 0.147714908 0.09788683 0.01296016 0.97514152 56 Monoisopropyl phthalate 0.002727611 0.04700664 0.053523623 2.18000e-10 0.024539355 0.160027449 0.86886293 0.94614685 0.61147644 57 Benzoxazole 0.091776986 0.75076374 0.276135210 1.02000e-09 0.096239488 0.002901873 0.50046660 0.98691513 0.43792748 58 Polyethylene, oxidized 0.061285147 0.95405127 0.000228929 4.31000e-06 0.108553306 0.002943554 0.67609401 0.92292276 0.01950354 59 His Ala Val Asp 0.065710666 0.70877365 0.000011100 1.73000e-08 0.000202542 0.000021200 0.99117306 0.32420843 0.73329743 60 Plumbagine 0.290365185 0.72424023 0.463202573 9.03000e-17 0.006162574 0.015234455 0.24172942 0.03899994 0.94452969
And please see Figure 4c and Figure 5c in this pub for an example.