Hello folks! For once I write a post in English... it actually corresponds to the vignette of a small package (flowrpowr) I wrote to celebrate my being back to work ;-). You might find that package quite superfluous, but my visual brains and I have been hoping for something like this for a while now :-). You can install this package from [my github repo][1], and I hope you will find it useful, fun, and not too flawed...
The convention for naming functions and functions’ arguments of packages in the tidyverse is such that these functions and arguments’ names help understand their purpose and construction.
#options(download.file.method = "libcurl")
#devtools::install_github("lvaudor/flowrpowr")
#devtools::install_github("thomasp85/ggforce")
library(flowrpowr)
The flowrpowr
package exploits that characteristic to produce graphs which intend to facilitate the exploration and understanding of a package’s content and of functions’ arguments.
Package’s functions
Let’s explore, for instance, the stringr
package:
flowr_package("stringr")
This graph lets us understand that many functions in this package will start with prefix “str_” and then lists all possible combinations (all functions of type str_*()
, for instance str_c()
and str_*_*()
-for instance str_replace_all()
-).
In the case of stringr
the common root str_
for many functions makes a tree-like layout easily readable:
flowr_package("stringr", layout="sugiyama")
Some packages gather many functions, which makes it preferable to display only some functions in the graph. For instance, the ggraph
package is quite big to be displayed in a single graph:
flowr_package("ggraph")
So it might be useful to display only part of the graph making use of an element of interest. For instance, if I’m looking, specifically, for some function regarding the edges:
flowr_package("ggraph", "edge")
Functions’ arguments
It is also possible to explore the arguments to one or several functions. Examining several functions at once help understand the arguments they have in common and the ones that are specific to each.
A few functions mean a few distinct roots, which might be well suited to a Sugiyama layout:
flowr_function(c("geom_violin","geom_point","geom_boxplot"),
layout="sugiyama")
2 Comments
Paulo
Very good! Your way of thinking is original!
It is not the complexity but the idea.
Jean Jacques
Carrément génial !
Dommage que je n'aie pas croisé ce package plus tôt !
(le blog aussi d'ailleurs ;-))
Tremendous !
JJ