[R] checking if a package is installed
pdb
philb at philbrierley.com
Fri Aug 27 03:07:32 CEST 2010
Hi,
I am writing a function that requires a specific package to be installed.
Is there a way of checking if the package is installed and returning a TRUE
/ FALSE result so my function can return an appropriate error message and
exit the function gracefully rather than just bombing out?
I'm thinking along the following lines (but want code that works),
f_checkpackage <- function()
{
if (library(madeupname) == TRUE) {
cat("package loaded OK\n")
}
else
{
cat("ERROR: package not loaded")
}
}
f_checkpackage()
--
View this message in context: http://r.789695.n4.nabble.com/checking-if-a-package-is-installed-tp2340534p2340534.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list