Package 'NoviceDeveloperResources2'

Title: Further Resources to Assist Novice Developers
Description: Assist novice developers when preparing a single package or a set of integrated packages to submit to CRAN. Provide additional resources to facilitate the automation of the following individual or batch processing: check local source packages; build local .tar.gz source files; install packages from local .tar.gz files; detect conflicts between function names in the environment. The additional resources include determining the identity and ordering of the packages to process when updating an imported package.
Authors: Barry Zeeberg [aut, cre]
Maintainer: Barry Zeeberg <[email protected]>
License: GPL (>= 2)
Version: 1.1.0
Built: 2024-11-01 03:08:51 UTC
Source: https://github.com/cran/NoviceDeveloperResources2

Help Index


bottomUpRecursive

Description

given a list of packages, determine which packages recursively import the packages in the list

Usage

bottomUpRecursive(l, p0)

Arguments

l

return value of retrieveNamespace()

p0

list of those packages whose R code has been modified by the developer

Value

returns a list of the original query packages plus the packages that directly import them

Examples

## Not run: 
# you need to specify dir, packs that are on your own computer !!
dir1<-"~/personal/hearts/hearts_card_game_bayesian_inference"
dir2<-"packages/inference_packages/inference_packages/"
packs<-c("cardUtils","clickableImageMap","editDriver",
"heartsCIM","iterationDriver","logos","playOneTrick",
"playWholeHandDriverPassParams","probTab","relaxDriver")
l<-retrieveNamespace(sprintf("%s/%s",dir1,dir2),packs)
bur<-bottomUpRecursive(l,c("iterationDriver"))

## End(Not run)

bottomUpRecursiveDriver

Description

compute a list of all the packages that either directly or indirectly import the original query packages

Usage

bottomUpRecursiveDriver(l, p0, verbose)

Arguments

l

return value of retrieveNamespace()

p0

list of those packages whose R code has been modified by the developer

verbose

if TRUE print line indicating the recursion level

Value

returns a list of all the packages that either directly or indirectly imports the original query packages

Examples

## Not run: 
# you need to specify dir, packs that are on your own computer !!
dir1<-"~/personal/hearts/hearts_card_game_bayesian_inference"
dir2<-"packages/inference_packages/inference_packages/"
packs<-c("cardUtils","clickableImageMap","editDriver",
"heartsCIM","iterationDriver","logos","playOneTrick",
"playWholeHandDriverPassParams","probTab","relaxDriver")
l<-retrieveNamespace(sprintf("%s/%s",dir1,dir2),packs)
burd<-bottomUpRecursiveDriver(l,c("iterationDriver"),TRUE)

## End(Not run)

PackageDependencies

Description

recursively call recursivePackageDependencies2() and reversePackageDependencies() to recursively delete leaf nodes until packs has been depleted to length zero

Usage

PackageDependencies(dir, packs, master, n, verbose)

Arguments

dir

character string containing the name of the directory holding packs

packs

list of package names

master

list whose componenets are lists indexed by integer recursion level the components of each recursion level are the return values of retrieveNamespace() and reversePackageDependencies()

n

integer recursion level

verbose

if TRUE print line indicating the recursion level

Details

NOTE that the packages in packs do not need to be loaded or attached to the search() path

Value

returns a list whose components are lists indexed by the integer recursion level:

l

return value of retrieveNamespace()

ll

return value of reversePackageDependencies()

Examples

## Not run: 
# you need to specify dir, packs that are on your own computer !!
dir1<-"~/personal/hearts/hearts_card_game_bayesian_inference"
dir2<-"packages/inference_packages/inference_packages/"
packs<-c("cardUtils","clickableImageMap","editDriver",
"heartsCIM","iterationDriver","logos","playOneTrick",
"playWholeHandDriverPassParams","probTab","relaxDriver")
master<-PackageDependencies(sprintf("%s/%s",dir1,dir2),packs, vector("list",length(packs)),1,TRUE)

## End(Not run)

retrieveLeafNodes

Description

compute a list of the packages in the correct order for processing by checkBuildInstallSourcePackage()

Usage

retrieveLeafNodes(master)

Arguments

master

return value of sortedInputForCheckBuildInstallSourcePackageDriver()

Details

the master list may contain some packages that do not need to be processed by checkBuildInstallSourcePackage(). These are weeded out by sortedInputForcheckBuildInstallSourcePackage()

Value

returns a list of the packages in the correct order for processing by checkBuildInstallSourcePackage()

Examples

## Not run: 
# you need to specify dir, packs that are on your own computer !!
dir1<-"~/personal/hearts/hearts_card_game_bayesian_inference"
dir2<-"packages/inference_packages/inference_packages/"
packs<-c("cardUtils","clickableImageMap","editDriver",
"heartsCIM","iterationDriver","logos","playOneTrick",
"playWholeHandDriverPassParams","probTab","relaxDriver")
master<-PackageDependencies(sprintf("%s/%s",dir1,dir2),packs,vector("list",length(packs)),1,TRUE)
retrieve<-retrieveLeafNodes(master)

## End(Not run)

retrieveNamespace

Description

retrieve a list of the imported packages in a NAMESPACE FILE

Usage

retrieveNamespace(dir, packs)

Arguments

dir

character string containing the name of the directory holding packs

packs

list of package names

Value

returns a list containing the intersection of (1) imported package names and (2) packs list

Examples

## Not run: 
# you need to specify dir, packs that are on your own computer !!
dir1<-"~/personal/hearts/hearts_card_game_bayesian_inference"
dir2<-"packages/inference_packages/inference_packages/"
dir<-sprintf("%s/%s",dir1,dir2)
packs<-c("cardUtils","clickableImageMap","editDriver",
"heartsCIM","iterationDriver","logos","playOneTrick",
"playWholeHandDriverPassParams","probTab","relaxDriver")
rns<-retrieveNamespace(dir,packs)

## End(Not run)

reversePackageDependencies

Description

separate the packages in packs list having length zero or non-zero dependencies

Usage

reversePackageDependencies(l)

Arguments

l

return value of retrieveNamespace()

Details

the return value ll is like:

$original [cardUtils is no longer a name of ll$original since it had length 0]

$original$editDriver

[1] "cardUtils" "clickableImageMap" "heartsCIM" "logos" "probTab"

$zeros

$zeros$cardUtils cardUtils is an element of ll$zeros since l[["cardUtils"]] has length 0

[1] "cardUtils"

Value

returns a list whose components are 2 lists:

$original

a list whose components are lists of package names that have non-zero length import dependencies ll$original is same as l, but deleting zero-length elements i.e., leaf nodes

$zeros

a list whose components are lists of package names that have zero length import dependencies (i.e., leaf nodes) ll$zeros zero-length elements, leaf nodes that had been deleted in ll$original

Examples

## Not run: 
# you need to specify dir, packs that are on your own computer !!
dir1<-"~/personal/hearts/hearts_card_game_bayesian_inference"
dir2<-"packages/inference_packages/inference_packages/"
packs<-c("cardUtils","clickableImageMap","editDriver",
"heartsCIM","iterationDriver","logos","playOneTrick",
"playWholeHandDriverPassParams","probTab","relaxDriver")
l<-retrieveNamespace(sprintf("%s/%s",dir1,dir2),packs)
ll<-reversePackageDependencies(l)

## End(Not run)

sortedInputForCheckBuildInstallSourcePackage

Description

compute a list of packages in the correct order to input to checkBuildInstallSourcePackage()

Usage

sortedInputForCheckBuildInstallSourcePackage(retrieve, burd)

Arguments

retrieve

return value of retrieveLeafNodes()

burd

return value of bottomUpRecursiveDriver()

Value

returns a list of packages in the correct order to input to checkBuildInstallSourcePackage()

Examples

## Not run: 
# you need to specify dir, packs that are on your own computer !!
dir1<-"~/personal/hearts/hearts_card_game_bayesian_inference"
dir2<-"packages/inference_packages/inference_packages/"
packs<-c("cardUtils","clickableImageMap","editDriver",
"heartsCIM","iterationDriver","logos","playOneTrick",
"playWholeHandDriverPassParams","probTab","relaxDriver")
master<-PackageDependencies(sprintf("%s/%s",dir1,dir2),packs,vector("list",length(packs)),1,TRUE)
l<-retrieveNamespace(sprintf("%s/%s",dir1,dir2),packs)
burd<-bottomUpRecursiveDriver(l,c("iterationDriver"),TRUE)
retrieve<-retrieveLeafNodes(master)
s<-sortedInputForCheckBuildInstallSourcePackage(retrieve,burd)

## End(Not run)

sortedInputForCheckBuildInstallSourcePackageDriver

Description

driver to invoke sequence of functions to retrieve the correctly ordered list of packages as input and to invoke checkBuildInstallSourcePackage()

Usage

sortedInputForCheckBuildInstallSourcePackageDriver(dir, packs, p0, verbose)

Arguments

dir

character string containing the path name of the directory holding the package folders

packs

list of package names

p0

list of those packages whose R code has been modified by the developer

verbose

if TRUE print line indicating the recursion level

Details

This driver is the single master function to run in order to invoke all of the other functions in the packages NoviceDeveloperResources and NoviceDeveloperResources2.

In the examples, I show the actual call using packages that are currently under development, so they are not yet available (I expect them to be available in mid-2024).

Value

a list whose components are the return values of checkBuildInstallSourcePackage() and conflictOfInterestRestricted()

Examples

## Not run: 
# you need to specify dir, packs that are on your own computer !!
dir1<-"~/personal/hearts/hearts_card_game_bayesian_inference"
dir2<-"packages/inference_packages/inference_packages/"
dir<-sprintf("%s/%s",dir1,dir2)
packs<-c("cardUtils","clickableImageMap","editDriver",
"heartsCIM","iterationDriver","logos","playOneTrick",
"playWholeHandDriverPassParams","probTab","relaxDriver")
l<-sortedInputForCheckBuildInstallSourcePackageDriver(dir,packs,packs,TRUE)

dir<-"~/personal/hearts/hearts_card_game_bayesian_inference/packages.12.25.23"
packs<-c("parseCreationTime","retrieve","probsDriverDriver","chisqDriver","html",
        "probsRandomDriverDriver","resamplingProbsMatrix","remapping")
lll<-sortedInputForCheckBuildInstallSourcePackageDriver(dir,packs,"retrieve",TRUE)

## End(Not run)