Get the packages

remotes::install_github("nrennie/ggflowchart")

remotes::install_github("giocomai/nomnomlgraph")

Basic example

nomnomlgraph

library("nomnomlgraph")
nodes <- tibble::tribble(~id, ~text, 
                         1, "Starting point",
                         2, "Other starting point",
                         3, "This is where things merge",
                         4, "This is where things go")

edges <- tibble::tribble(~from, ~to, ~association,
                         1, 3, "-", 
                         2, 3, "-",
                         3, 4, "->")

nn_graph(nodes = nodes, 
         edges = edges)

Only minor adjustments between the two formats needed.

library("ggflowchart")

edges_ggflowchart <- edges %>% 
  dplyr::mutate(dplyr::across(dplyr::everything(),as.character))

nodes_ggflowchart <- nodes %>% 
  dplyr::transmute(name = as.character(id),
                   label = text)

ggflowchart(data = edges_ggflowchart,
            node_data = nodes_ggflowchart)

More complex example

Data from a post, just a ready-made example in this format.

edges <- readr::read_csv("https://raw.githubusercontent.com/giocomai/tadadit/main/posts/2022-10-content-analysis-toolkit-for-starters/edges_full.csv")

nodes <- readr::read_csv("https://raw.githubusercontent.com/giocomai/tadadit/main/posts/2022-10-content-analysis-toolkit-for-starters/nodes_full.csv")
nn_graph(nodes = nodes, 
         edges = edges)
edges_ggflowchart <- edges %>% 
  dplyr::mutate(dplyr::across(dplyr::everything(),as.character))

nodes_ggflowchart <- nodes %>% 
  dplyr::transmute(name = as.character(id),
                   label = text)

ggflowchart(data = edges_ggflowchart,
            node_data = nodes_ggflowchart)