Skip to content
Prev 221290 / 398500 Next

avoiding reinstall already installed *package*

I hate to get into arguments over function names, but
I would have thought that require("pkg") would throw
an error if the required pkg was not available.  It seems
like require() can be used when pkg is not really required
but library("pkg") is easiest when pkg is required to
continue:

  > { require("noSuchPackage"); functionFromNoSuchPackage() }
  Loading required package: noSuchPackage
  Error: could not find function "functionFromNoSuchPackage"
  In addition: Warning message:
  In library(package, lib.loc = lib.loc, character.only = TRUE,
logical.return = TRUE,  :
    there is no package called 'noSuchPackage'
  > { library("noSuchPackage"); functionFromNoSuchPackage() }
  Error in library("noSuchPackage") :
    there is no package called 'noSuchPackage'

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com