[R] avoiding reinstall already installed *package*

William Dunlap wdunlap at tibco.com
Tue May 18 22:38:54 CEST 2010


> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Martin Maechler
> Sent: Tuesday, May 18, 2010 1:25 PM
> To: milton ruser
> Cc: r-help at r-project.org
> Subject: Re: [R] avoiding reinstall already installed *package*
> 
> On Tue, May 18, 2010 at 18:06, milton ruser 
> <milton.ruser at gmail.com> wrote:
> 
> > Hi Martin,
> >
> > thanks for your reply, and very thanks for your kind tips 
> about "package"
> > and "library"
> > So, I was trying to understand *why* we load packages using 
> library().
> >
> 
> I've started to use and suggest using   require(.) instead
> {as my efforts to introduce  use() or usePackage() *and* deprecating
>  library()  where met with strong opposition}

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 

> 
> 
> > I suggest that developers killl the problem on its root, 
> deleting library
> > function :-)
> > Good to know already installed packages will not be reinstalled.
> >
> > cheers
> >
> > milton
> >
> > On Tue, May 18, 2010 at 12:49 PM, Martin Maechler <
> > maechler at stat.math.ethz.ch> wrote:
> >
> >> { I've modified the subject; I can't stand it hitting square into
> >>  my face ... }
> >>
> >> >>>>> "mr" == milton ruser <milton.ruser at gmail.com>
> >> >>>>>     on Tue, 18 May 2010 12:36:23 -0300 writes:
> >>
> >>    mr> Dear R-experts,
> >>    mr> I am installing new libraries using
> >>    mr> install.packages("ggplot2",dependencies=T).
> >>    mr> But I perceive that many dependencies are already 
> installed. As I
> >> am using
> >>    mr> a low-band internet, how can avoid reinstall 
> installed libraries?
> >>
> >> There's no problem with installed libraries, as ...
> >> they DO NOT EXIST.
> >>
> >> These are *PACKAGES* !
> >> Why do you think are you talking about the function
> >>
> >>  install.packages()  ????
> >>         ^^^^^^^^
> >>
> >> ---
> >> To answer the question you did want to ask:
> >>
> >> Do not be afraid:  Depedencies are only installed when needed,
> >> i.e., no package will be downloaded and installed if it already
> >> is there.
> >>
> >> Martin Maechler, ETH Zurich
> >>
> >>    mr> cheers
> >>
> >>    mr> milton
> >>
> >>    mr> [[alternative HTML version deleted]]
> >>        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >> (another thing you should learn to avoid, please)
> >>
> >>
> >
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 



More information about the R-help mailing list