| Version: | 1.0 |
| Date: | 2026-05-25 |
| Title: | Automate Retrieving, Building, Installing and Loading Specified Packages |
| Maintainer: | Barry Zeeberg <barryz2013@gmail.com> |
| Author: | Barry Zeeberg [aut, cre] |
| Depends: | R (≥ 4.2.0) |
| Imports: | utils, stringr, devtools, tools, vprint |
| Description: | Packages required for the search path may be located in the CRAN repository, the system library, or a local directory. We automate determining the disposition of each required package, retrieving it, and loading it as needed. |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| Encoding: | UTF-8 |
| VignetteBuilder: | knitr |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2026-06-01 20:42:49 UTC; barryzeeberg |
| Config/roxygen2/version: | 8.0.0 |
| Repository: | CRAN |
| Date/Publication: | 2026-06-08 15:10:09 UTC |
autoLibLoad
Description
given a list of packages, which ones are available from search path, installed packages, loaded packages, local directory
Usage
autoLibLoad(dir, packs, verbose = c(0, 3))
Arguments
dir |
character string full path name of directory containing package sources |
packs |
list of package names |
verbose |
integer param passed to vprint() |
Value
returns no value, but has side effect of modifying search() path and installing packages from CRAN
Examples
## Not run:
# replace dir and packs with your own versions!!
try(remove.packages("cardUtils"))
try(detach("package:cardUtils"))
try(remove.packages("ggplot2"))
try(detach("package:ggplot2"))
dir1<-"~/personal/hearts/hearts_card_game_bayesian_inference/packages/"
dir2<-"inference_packages/inference_packages/"
dir<-sprintf("%s/%s",dir1,dir2)
packs<-c("cardUtils","clickableImageMap","ggplot2","xxxx")
l<-autoLibLoad(dir,packs)
## End(Not run)
getSysLib
Description
For consistency, make sure that we are always using the designated library rather than a random library
Usage
getSysLib(verbose = 4)
Arguments
verbose |
parameter passed to vprint() |
Value
returns a character string containing the path name for the designated library
Examples
if(interactive()) {
sysLib<-getSysLib()
}
is_package_on_cran2
Description
which pakages in list are available on CRAN
Usage
is_package_on_cran2(pkg_names)
Arguments
pkg_names |
list of package names |
Value
returns a list of packages that are available on CRAN
Examples
is_package_on_cran2(c("ggplot2","xxxxx"))
loadPacks
Description
load packages as required
Usage
loadPacks(packs)
Arguments
packs |
list of package names |
Details
not allowed to have direct call to library() in CRAN package version that is permitted in CRAN package - see zload() in NoviceDeveloperResources package
Value
returns no value, but has side effect of loading packages in search() path
Examples
## Not run:
# replace dir and packs with your own versions!!
install.packages("ggplot2")
packs<-"ggplot2"
l<-loadPacks(packs)
## End(Not run)
## Not run:
# replace pack with your own versions!!
pack<-"ggplot2"
install.packages(pack)
eval(parse(text = sprintf("library(%s, verbose=TRUE)",pack)))
## End(Not run)
packagesInDir
Description
determine potential R packages within a given directory
Usage
packagesInDir(dir)
Arguments
dir |
character string full path name to directory holding R packages |
Value
returns a list of potential R packages
Examples
## Not run:
# replace dir and packs with your own versions!!
dir1<-"~/personal/hearts/hearts_card_game_bayesian_inference/packages/"
dir2<-"inference_packages/inference_packages/"
dir<-sprintf("%s/%s",dir1,dir2)
packagesInDir(dir)
## End(Not run)