[Rd] require is to suggests as what is to imports?
Dirk Eddelbuettel
edd at debian.org
Tue Aug 24 22:51:31 CEST 2010
On 24 August 2010 at 15:40, Hadley Wickham wrote:
| Hi all,
|
| If a package suggests another package in its description, you can
| check it at runtime with requires. How do you do check if a package
| is available without loading it, if you only want to access one
| function in the package namespace.
I needed this a few days ago for a small package and resorted to this:
.packages <- as.character(installed.packages()[,1])
[...]
hasGputools <- function() {
any( "gputools" == .packages )
}
That way I get around Depends, Suggests and other thing that may impact the
running of 'R CMD check' and friends.
Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the R-devel
mailing list