Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested taf.libraries() #15

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions R/taf.libraries.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#' TAF Libraries
#'
#' Load and attach all packages from local TAF library.
#'
#' @param messages whether to show messages when package loads.
#' @param warnings whether to show warnings when package loads.
#'
#' @return TRUE (invisibly) if all packages loaded
#'
#' @note
#' Packages in the TAF library are loaded in the order in which they are
#' listed in SOFTWARE.bib. Internal dependencies can in this way be respected.
#'
#' @seealso
#' \code{\link{taf.library}} is the TAF function called for each found package.
#'
#' @examples
#' \dontrun{
#'
#' # Load all packages in TAF library
#' taf.libraries()
#'
#' }
#'
#' @export

taf.libraries <- function(messages=FALSE, warnings=FALSE) {

bib <- TAF:::read.bib(file.path(boot.dir(), "SOFTWARE.bib"))

entries <- names(bib)

installed <- taf.library()

pkgs <- entries[entries %in% installed]

res <- lapply(pkgs, function(x) {
if(dir.exists(file.path(boot.dir(), "library", x)))
do.call("taf.library", list(package=x, messages=messages,
warnings=warnings))
})

invisible(TRUE)
}
35 changes: 35 additions & 0 deletions man/taf.libraries.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.