When our Chief Data Scientist, Rich Pugh, offered to write a blogpost about the DiagrammeR package, he asked what format we’d like it in. “A poem?” we retorted.
He didn’t disappoint….
Gather ye and listen to my tale of daring do,
Of heroes, villains, diagrams – and a chunk of R code too,
Wherefore my tale involves the noble Knight, Sir DiagrammeR,
Who brought the power of Knights of old – our own true Excalibur!
My tale begins in the office towers of a client in the city,
Where the coffee’s really strong, and the banter’s rather witty,
A place where we’ve delivered lots of data-driven gold,
With the fighting led by Mango Knights, heroic, brave and bold,
Whence our discussions quickly led to Data Science skill,
And the time required to cross-train a group of Analysts, who will
Become good Sirs and Ladies of a new Data Science team,
But how to design and communicate, this audacious training scheme?
Up went the cry, “A diagram is really what we need,
To explain the likely investment and time needed to lead
These Analysts who wish to learn to wield an Analytic sword,
A diagram would help us communicate this to the board.”
In burst the good Sir Powerpoint, upon his paper-clip-shaped mount,
“Did someone want a diagram?” this Gentleman did shout,
“For I have pre-built charts and things that really look quite neat,
And as a creator of diagrams I really can’t be beat!”
“Huzzah!” they said “that surely is the answer to our plight”,
But the skillful Mango Knights demurred, “this course may not be right,
Sir Powerpoint may have armour and a flashy, prancing steed,
But he certainly won’t provide us with the capabilities we need”
“We really want to simulate this cross-train exercise,
With a presentation of results to verily delight the eyes,
So members of the board will clearly understand the way,
To build a team with DS skills so they can win the day!”
All agreed Sir Powerpoint was really not the answer,
So with a nod we all dismissed this brave and brilliant lancer,
Instead those expert Mango Knights immediately did clamour,
To summon that brave hero, the good Sir DiagrammeR!
In walked the gent, who truly was the answer to our prayers,
He helped us build a diagram of lines and text and squares,
And since it was produced in R (that really is quite swell),
We could proceed to populate it with simulated scenarios as well,
A create_node_df call meant we could define the nodes,
We also used this function to set attributes (of which there are loads),
Such as labels, colour and shape – oh, the things we could control!
We could even define a bespoke layout to help achieve our goal.
Next we used create_edge_df to define the transition,
Of the skills of their DS team throughout their training mission,
We also annotated edges with some labels to convey,
The estimated time to upskill folks to B from A,
A simple call to create_graph then allowed us to combine,
Both edge and node dfs into an object we did assign,
Then render_graph created the spectacular show,
With options for the layout (we just chose “neato”),
It really was quite easy to produce the final chart,
With fine control the diagram looked like a work of art,
The use of simple data frames meant creation was a breeze,
And decent online docs meant we could build the thing with ease,
The output was fantastic – and thus the day was won,
The finished docs and examples confirmed our work was done,
In such a timely manner too – we’d worked at such great speed,
We retired early to the tavern to celebrate with ales and mead.
And thus our tale is ended, and the hero of the hour,
Was certainly Sir DiagrammeR and his chart-creation power,
It really is a top package with well-written documentation,
We heartily recommend it for diagram creation!