knitr::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE)
set.seed(33)
#options(download.file.method = "libcurl")
#devtools::install_github("lvaudor/flowrpowr")
#devtools::install_github("thomasp85/ggforce")
library(flowrpowr)

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.

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, I can either highlight the elements linked to node "edge" (and thus still display all other elements)

flowr_package("ggraph", highlighted="edge")

or just keep the elements in the graph:

flowr_package("ggraph", element="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")


lvaudor/flowrpowr documentation built on Oct. 20, 2020, 8:47 a.m.