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.
Figure 1 demonstrates using the interactive mode of foodwebWrapper(). This mode has the advantage of displaying the valid inputs to the user. Batch mode is also available, in which the package names are input via the command line parameter where=c(“pack1”,“pack2”, . . . “packN”). Batch mode is more convenient if you already have in hand a valid list of the desired packages.
Finally, as a diversion from the monotony of the little rectangles, we can specify random chess pieces by pawns=TRUE