Skip to content

Commit

Permalink
Merge pull request #15 from iagomosqueira/master
Browse files Browse the repository at this point in the history
Suggested taf.libraries()
  • Loading branch information
arni-magnusson authored Jul 17, 2023
2 parents 86086b8 + 4bbb7e2 commit 2f19591
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
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.

0 comments on commit 2f19591

Please sign in to comment.