knitr::opts_chunk$set( comment = "#>", tidy = FALSE, error = FALSE, fig.width = 8, fig.height = 8)
Railroad Diagrams for R
Generate railroad diagrams in R with the convenience and infrastructure of htmlwidgets, or eventually create static SVG railroad diagrams for use in non-htmlwidget situations. Thanks so much to Tab Atkins, Jr. for the JavaScript library railroad-diagrams that actually does all the hard work.
devtools::install_github("timelyportfolio/railroadR")
library(railroadR) railroad( Choice(0, 'u', 'U'), Choice(0, 'r', 'R'), Choice(0, 'l', 'L'), '(', Choice(1, Optional(NonTerminal('WS')), Sequence( Optional(NonTerminal('WS')), NonTerminal('STRING', '#string'), Optional(NonTerminal('WS'))), Sequence( Optional(NonTerminal('WS')), OneOrMore( Choice(0, NonTerminal('not " \' ( ) WS or NPC'), NonTerminal('escape'))), Optional(NonTerminal('WS')) ) ), ')' )
MIT + file LICENSE © Kenton Russell.
railroad-diagrams JavaScript library CC0 LICENSE © Tab Atkins, Jr.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.