"Henrik Bengtsson" <[EMAIL PROTECTED]> writes: > Hi, > > for 'affxparser' (Bioconductor), we needed a function to test if a > certain package was loaded or not, but we did not want to load it if > it wasn't, which is why we couldn't use require(). We came up with > the following solution: > > isPackageLoaded <- function(package, version=NULL, ...) { > s <- search(); > if (is.null(version)) { > s <- sub("_[0-9.-]*", "", s); > } else { > package <- manglePackageName(package, version); > } > pattern <- sprintf("package:%s", package); > (pattern %in% s); > }
This only tests whether or not the given package is attached to the search path. You also (I think) want to search loaded namespaces. But I think such a helper would be useful in general. + seth -- Seth Falcon | [EMAIL PROTECTED] | blog: http://userprimary.net/user/ ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel