Marius:

Can you not, instead of

if(pkg == "loon" && !requireNamespace("loon", quietly = TRUE))
        stop("Package 'loon' is not available.")

do something like:

if(pkg == "loon" && !requireNamespace("loon", quietly = TRUE)) {
        cat("Package 'loon' is not available.\n")
        cat("Sorry 'bout that, chief!\n")
        return(invisible())
}

Thereby no error is thrown.  The user may be unhappy with the result,
but he or she would have been similarly unhappy with the error, and
there is no way of constructing your function so that such a user *will* be happy.

cheers,

Rolf Turner

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to