Wrapper to Enhance the Functionality of the
mvbutils::foodweb() Function
Barry
Zeeberg
One component of the return value of the mvbutils::foodweb() function is funmat. This component is described by the original authors as “a matrix of 0s and 1s showing what (row) calls what (column). The dimnames are the function names.”
I found this component to be very useful in helping me track my own development efforts, especially when my functions were distributed among several of my own under-development packages as well as established CRAN packages. But it was frustrating to me that the package associations of the tabulated functions were not shown.
I was able to use another function find_funs() to determine that association, and then fold that into the funmat component of foodweb(). Finally, I was able to render the augmented table as html, in which the package names and functions were color-coded by package name, and the package names were hyperlinked to the corresponding CRAN pdf documentation.
After running the program in the R Console (Figure 1), a typical example (Figure 2) was obtained
The rows represent the calling function, and the columns represent the called function. The color coding of the header information allows the visual intuition of the package structure. The color coding of the calling function is inherited by the relevant matrix row cells, to facilitate tracing the inheritance down from the package of the calling function.
The invoking call can itself contain the parameters where and prune. In that case the additional package or function names that are selected interactively are concatenated to those in the command line. It is a little easier to specify these interactively, as that procedure will prevent specifying useless parameter values. The final set of these parameter values are archived in an output file that has the same name as the .html file with .txt appended.
The behavior of the prune should be mentioned. The parameter values are the names of functions, and when given, the output is restricted to those branches that include the given pruning functions. However, when multiple pruning functions are given, then the output is enlarged to the union of the pruning branches. This is not my design, it is the pre-existing behavior of the underlying foodweb() function.
Finally, as a diversion from the monotony of the little rectangles, we can specify random chess pieces by pawns=TRUE