R Under development (unstable) (2024-10-14 r87233 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(qwraps2) > > # verify the return is TRUE for a set of installed packages > stopifnot(pkg_check(c("qwraps2", "ggplot2"))) > > # verify a return of FALSE if at least one of the packages is not installed > stopifnot(pkg_check(c("qwraps2", "NOT A PKG")) == FALSE) > > # verify FALSE is installed package is < provided version > stopifnot(pkg_check(c("qwraps2"), "999.999.999") == FALSE) > > # Expect an error to be thrown with the `stop` arguement is used. > test <- tryCatch(pkg_check(c("qwraps2", "NOT A PKG"), stop = TRUE), error = function(e) e) [1] FALSE attr(,"checks") package version available installed_version qwraps2 qwraps2 NA TRUE 0.6.1 NOT A PKG NOT A PKG NA FALSE > stopifnot(inherits(test, 'error')) > > > proc.time() user system elapsed 0.23 0.03 0.25