Reference: https://towardsdatascience.com/how-to-plot-graphs-using-the-diagrammer-package-in-r-3fe4642091cc
library(DiagrammeR)
Final_graph <- grViz("
digraph {
layout = dot
node [shape=rectangle ,color=grey,style=filled,fixedsize=False,width=2.3]
edge[color=black,arrowhead=vee]
A[label = 'Total SMS(n=600000)']
B[label = 'Excluded-invalid
numbers (n=93244)']
C[label = 'Viewed (n=32182)']
D[label = 'Did not answer (n=30346)']
E[label = ' Answered (n=2154)']
F[label= 'Completed (n=1938)']
G[label= 'Did not complete (n=216)']
H[label='Didnot want to share thier information (n=143)
Did not want to participate (n=58)
Incomplete response (n=15)']
A->B
A->C
C->D
C->E
E->G
G->H
edge [minlen = 2]
E->F
}")
Final_graph
output= "jpeg"