I want to create a flowchart with the R
package DiagrammeR
. The text of some of the nodes should have a line break.
Consider the following reproducible example in R
:
library("DiagrammeR")
# Create a node data frame (ndf)
ndf <- create_node_df(n = 4,
label = c("hi stacko", "aaa", "bbb", "ccc"))
# Create an edge data frame (edf)
edf <- create_edge_df(from = c(1, 2, 3, 3),
to = c(4, 3, 1, 4))
# Create a graph with the ndf and edf
graph <- create_graph(nodes_df = ndf,
edges_df = edf)
# Create a PDF file for the graph (`graph.pdf`)
graph %>%
render_graph()
In this flowchart, I would like to add a line break between "hi" and "stacko" in the lower left node. I found some sources that suggested <br>
or \n
. Unfortunately, both did not work.
Question: How could I insert a line break in DiagrammeR
?