Author: Barry Zeeberg [aut, cre]
Date: 2026-06-03

# consolidatePacks

#### Barry Zeeberg [aut, cre]

#### 2026-06-03

consolidatePacks

Barry Zeeberg

barryz2013@gmail.com

Motivation

The purpose of this package is to remove the ‘@import’ dependence of your package by consolidating the functions into your package. This may be necessary when the imported package is decommissioned by CRAN, and you do not want your dependent package to also be decommissioned.

Methods

The functions in this package recursively retrieve dependencies in your package, and copy the retrieved functions to the .R file. They also perform other needed bookkeeping, such as retrieving .Rd files in the man subdirectory.

Results

This package was developed when my package foodwebWrapper faced being decommissioned from CRAN because an imported package mvbutils was going to be decommissioned. I decided to retrieve foodweb(), which is the one function from mvbutils that foodwebWrapper needs. Of course the foodweb() dependencies also needed to be retrieved recursively.

Before invoking drDriver(), you need to make sure that both your package and the package containing the dependencies are loaded in the search() path. If the package containing the dependencies contains any functions that are not exported, then the functions must be copied and pasted into the Console in which the driver will be invoked.

Some consistency checking and other tasks are automatically performed when the driver is invoked, including making a working copy of your package directory.

The driver was invoked by

    drDriver(f="foodwebWrapper",r="/Users/barryzeeberg/personal/
    mvbutil_download/mvbutils/",pack2Copy="/Users/barryzeeberg/
    personal/hearts/hearts_card_game_bayesian_inference/packages/
    foodwebWrapper",verbose=2)

Here are some annotated snippets of the transaction log:

Partial Trace of the Recursion . . .

    [1] _________________________________________
    [1] Recursion Level = 1
    [1] foodwebWrapper
    [1]
    [1] Function Number = 1 Function = foodwebWrapper
    [1] functions list:
    [1] foodweb
    [1] _________________________________________
    [1] Recursion Level = 2
    [1] foodweb
    [1]
    [1] Function Number = 1 Function = foodweb
    [1] functions list:
    [1] find.funs            %is.a%               extract.named        %matching%           find.web             organize.web.display
    [1] _________________________________________
    [1] Recursion Level = 3
    [1] find.funs            %is.a%               extract.named        %matching%           find.web             organize.web.display
    [1]
    [1] Function Number = 1 Function = find.funs
    [1] functions list:
    [1] named    lsall    %except% mcachees pos      as.env
    [1] _________________________________________

Partial Transaction Log for Copying Files . . .

    [1] addMan copying:
    [1] from /Users/barryzeeberg/personal/mvbutil_download/mvbutils//foodweb.Rd
    [1] to /var/folders/3g/1drmqz0j5dq0xv88h3cg2k080000gn/T//RtmpC0Fwy1/foodwebWrapper/man/foodweb.Rd
    [1] addMan copying:
    [1] from /Users/barryzeeberg/personal/mvbutil_download/mvbutils//find.funs.Rd
    [1] to /var/folders/3g/1drmqz0j5dq0xv88h3cg2k080000gn/T//RtmpC0Fwy1/foodwebWrapper/man/find.funs.Rd
    [1] addMan copying:
    [1] from /Users/barryzeeberg/personal/mvbutil_download/mvbutils//%is.a%.Rd
    [1] to /var/folders/3g/1drmqz0j5dq0xv88h3cg2k080000gn/T//RtmpC0Fwy1/foodwebWrapper/man/%is.a%.Rd

Might Need a Small Amount of Manual Tuning before Importing into RStudio . . .

    The driver provides the option implement check() at the end of the processing stream. This allows you to catch glitches that you might need to correct by hand before importing into RStudio. In my case, I ran into some missing globals definitions, etc.

Reminders for Wrapping up . . .
Note that the working version of the package is located in a path name that (at least on mac computer) is “private,” and it is difficult to figure out how to get your hands on it. So I provide a brief instruction for how to do so.

Also, if you are happy with the enhanced working package, it is safest to make a copy of it because the driver may inadvertently overwrite this version.

    [1] "Remember to update version number and date in the DESCRIPTION file"
    [1] "To open the package in RStudio, Finder > Open Project in New Session . . ."
    [1] "For mac, press Command + Shift + G to open the 'Go to the folder' window"
    [1] "Then copy and paste e.g. /var/folders/3g/1drmqz0j5dq0xv88h3cg2k080000gn/T//RtmpC0Fwy1 into the 'Go to the folder' window"