| 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: | 2026-05-31 09:45:02 UTC |
| Source: | https://github.com/cran/NoviceDeveloperResources2 |
given a list of packages, determine which packages recursively import the packages in the list
bottomUpRecursive(l, p0)bottomUpRecursive(l, p0)
l |
return value of retrieveNamespace() |
p0 |
list of those packages whose R code has been modified by the developer |
returns a list of the original query packages plus the packages that directly import them
## 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)## 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)
compute a list of all the packages that either directly or indirectly import the original query packages
bottomUpRecursiveDriver(l, p0, verbose)bottomUpRecursiveDriver(l, p0, verbose)
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 |
returns a list of all the packages that either directly or indirectly imports the original query packages
## 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)## 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)
recursively call recursivePackageDependencies2() and reversePackageDependencies() to recursively delete leaf nodes until packs has been depleted to length zero
PackageDependencies(dir, packs, master, n, verbose)PackageDependencies(dir, packs, master, n, verbose)
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 |
NOTE that the packages in packs do not need to be loaded or attached to the search() path
returns a list whose components are lists indexed by the integer recursion level:
l |
return value of retrieveNamespace() |
ll |
return value of reversePackageDependencies() |
## 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)## 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)
compute a list of the packages in the correct order for processing by checkBuildInstallSourcePackage()
retrieveLeafNodes(master)retrieveLeafNodes(master)
master |
return value of sortedInputForCheckBuildInstallSourcePackageDriver() |
the master list may contain some packages that do not need to be processed by checkBuildInstallSourcePackage(). These are weeded out by sortedInputForcheckBuildInstallSourcePackage()
returns a list of the packages in the correct order for processing by checkBuildInstallSourcePackage()
## 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)## 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)
retrieve a list of the imported packages in a NAMESPACE FILE
retrieveNamespace(dir, packs)retrieveNamespace(dir, packs)
dir |
character string containing the name of the directory holding packs |
packs |
list of package names |
returns a list containing the intersection of (1) imported package names and (2) packs list
## 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)## 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)
separate the packages in packs list having length zero or non-zero dependencies
reversePackageDependencies(l)reversePackageDependencies(l)
l |
return value of retrieveNamespace() |
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"
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 |
## 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)## 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)
compute a list of packages in the correct order to input to checkBuildInstallSourcePackage()
sortedInputForCheckBuildInstallSourcePackage(retrieve, burd)sortedInputForCheckBuildInstallSourcePackage(retrieve, burd)
retrieve |
return value of retrieveLeafNodes() |
burd |
return value of bottomUpRecursiveDriver() |
returns a list of packages in the correct order to input to checkBuildInstallSourcePackage()
## 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)## 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)
driver to invoke sequence of functions to retrieve the correctly ordered list of packages as input and to invoke checkBuildInstallSourcePackage()
sortedInputForCheckBuildInstallSourcePackageDriver(dir, packs, p0, verbose)sortedInputForCheckBuildInstallSourcePackageDriver(dir, packs, p0, verbose)
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 |
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).
a list whose components are the return values of checkBuildInstallSourcePackage() and conflictOfInterestRestricted()
## 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)## 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)