[R] install.packages() for local source file

Paul Roebuck roebuck at odin.mdacc.tmc.edu
Sat Jan 1 23:48:35 CET 2005


On Sat, 1 Jan 2005, Liaw, Andy wrote:

> > From: Paul Roebuck
> >
> > > Please read ?install.packages.  It's most definitely not a bug for a
> > > function that works as documented.  If you want, you might take the
> > > source for install.packages and strip it down to do what you want,
> > > say something called installLocalPackages.
> >
> > Well, I called myself having read it but it still wasn't obvious
> > to me; hence I posted the question here. Exactly which part should
> > I have read more carefully? I will grant that I left out one thing
> > when I did my cut'n'paste but it doesn't change the result.
> > My attempt to install my local package should have read:
> >
> > > install.packages("mypkg",
> >                    contriburl = uri.pkg,
> >                    lib = Sys.getenv("R_LIBS"))
> >
> > Looking at the source, 'tmpd' is only set if the protocol
> > is not "file:". Since I use that protocol, it would seem
> > to me that passing 'NULL' instead of 'tempfile("Rinstdir")'
> > would constitute a bug.
>
> The version of ?install.packages (in R-2.0.1) I've read never said
> it could install local source packages, so why would it be
> considered a bug not being able to do something that is never
> claimed?  You seem to expect the function to do something that
> it is never designed to do.

The name of the routine made the claim, not I.
One could be forgiven for assuming it could since the
'contriburl' argument implies it could use a CD. I've
used it in the past for local installs by simulating
the CRAN directory structure and overriding the 'CRAN'
argument but that's kind of a hassle for something quick.
Perhaps it should be renamed 'install.packages.from.CRAN'
since the current name implies something different to me.

The programmer in me would still call the current situation
a bug - the if statement around the 'localcran' variable
is missing the else case to handle this scenario. Assuming
so, I really don't see why this [w|c]ouldn't handle local source
installs. And if it can't (and never could be made to do so),
then the code should have a 'stop("local install unimplemented")'
there so no one else ever has to ask again.

----------------------------------------------------------
SIGSIG -- signature too long (core dumped)




More information about the R-help mailing list