Re: [R] checking if a package is installed

2010-08-26 Thread Prof Brian Ripley
On Thu, 26 Aug 2010, Jorge Ivan Velez wrote: Hi pdb, Take a look at http://r.789695.n4.nabble.com/test-if-a-package-is-installed-td1750671.html#a1750674 You are citing yourself with a poor solution (calling installed.packages()) -- so please don't. The help page for installed.packages in R

Re: [R] checking if a package is installed

2010-08-26 Thread Dejian Zhao
require() does what you want. Run "?require" for details. require() returns 'FALSE' and gives a warning (rather than an error as 'library()' does by default) if the package does not exist. 'require' returns (invisibly) a logical indicating whether the required package is available. (You can c

Re: [R] checking if a package is installed

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 9:07 PM, pdb wrote: 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 functio

Re: [R] checking if a package is installed

2010-08-26 Thread Jorge Ivan Velez
Hi pdb, Take a look at http://r.789695.n4.nabble.com/test-if-a-package-is-installed-td1750671.html#a1750674 HTH, Jorge On Thu, Aug 26, 2010 at 9:07 PM, pdb <> wrote: > > Hi, > > I am writing a function that requires a specific package to be installed. > > Is there a way of checking if the pac

[R] checking if a package is installed

2010-08-26 Thread pdb
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 thi