Go to TogaWare.com Home Page. Data Science Desktop Survival Guide
by Graham Williams
Duck Duck Go

Adding a Flowchart

Raw LaTeX and R both support extensive capability for generating pictures. Here we use the diagram package to draw a flow chart, something that is a common requirement in documentation. The simple example shows the process of converting a .Rnw file using knitr to a LaTeX file which can then be processed by pdflatex to generate the .pdf file. The result can be seen in Figure 22.2.

# Load package from the local library into the R session.

library(diagram)

# Identify some names for the nodes of the flowchart.

names   <- c(".Rnw", ".tex", ".pdf")

# Set up the connectivity data.

connect <- c(0,       0,          0,
             "knitr", 0,          0,
             0,       "pdflatex", 0)

# Constract a connectivity matrix and plot the flowchart.

matrix(nrow=3, ncol=3, byrow=TRUE, data=connect) %>%
  plotmat(pos=c(1, 2), name=names, box.col="orange")

Figure 22.2: The knitr process to generate a pdf.

\includegraphics[width=\textwidth]{figures/onepager/knitr:knitr_diagram_flowchart-1}

There are many more possibilities provided by diagram and if interested you can explore demo(plotmat) and demo(plotweb).


Support further development by purchasing the PDF version of the book.
Other online resources include the GNU/Linux Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 2000-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.