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

2005-01-01 Thread Liaw, Andy
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.

Andy 

 From: Paul Roebuck
 
 Wish to install a local source package on Un*x platform from
 within R. Same thing as I can accomplish from cmdline as
 
 $ export R_LIBS=~/R/library
 $ cd /path/to/pkg
 $ R CMD INSTALL -l $R_LIBS pkgname
 
 
 So, how do you go about this anyway?
 And isn't this a bug in 'install.packages'?
 
 ---
 $ R
 
 R : Copyright 2004, The R Foundation for Statistical Computing
 Version 1.9.0  (2004-04-12), ISBN 3-900051-00-3
 
  file.pkg - mypkg_0.1.tar.gz
  path.pkg - file.path(path.expand(~), cvknn, file.pkg)
  file.exists(path.pkg)
 [1] TRUE
  uri.pkg - paste(file://, path.pkg, sep = )
  install.packages(contriburl = uri.pkg, lib = Sys.getenv(R_LIBS))
 Error in file.info(x) : Object tmpd not found
  traceback()
 4: file.info(x)
 3: dirTest(destdir)
 2: download.packages(pkgs, destdir = tmpd, available = available,
contriburl = contriburl, method = method)
 1: install.packages(contriburl = uri.pkg, lib = Sys.getenv(R_LIBS))
  version
  _
 platform sparc-sun-solaris2.9
 arch sparc
 os   solaris2.9
 system   sparc, solaris2.9
 status
 major1
 minor9.0
 year 2004
 month04
 day  12
 language R
 
 
 --
 SIGSIG -- signature too long (core dumped)
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2005-01-01 Thread Paul Roebuck
On Sat, 1 Jan 2005, Liaw, Andy wrote:

  From: Paul Roebuck
 
  Wish to install a local source package on Un*x platform from
  within R. Same thing as I can accomplish from cmdline as
 
  $ export R_LIBS=~/R/library
  $ cd /path/to/pkg
  $ R CMD INSTALL -l $R_LIBS pkgname
 
 
  So, how do you go about this anyway?
  And isn't this a bug in 'install.packages'?
 
  ---
  $ R
 
  R : Copyright 2004, The R Foundation for Statistical Computing
  Version 1.9.0  (2004-04-12), ISBN 3-900051-00-3
 
   file.pkg - mypkg_0.1.tar.gz
   path.pkg - file.path(path.expand(~), cvknn, file.pkg)
   file.exists(path.pkg)
  [1] TRUE
   uri.pkg - paste(file://, path.pkg, sep = )
   install.packages(contriburl = uri.pkg, lib = Sys.getenv(R_LIBS))
  Error in file.info(x) : Object tmpd not found
   traceback()
  4: file.info(x)
  3: dirTest(destdir)
  2: download.packages(pkgs, destdir = tmpd, available = available,
 contriburl = contriburl, method = method)
  1: install.packages(contriburl = uri.pkg, lib = Sys.getenv(R_LIBS))
   version
   _
  platform sparc-sun-solaris2.9
  arch sparc
  os   solaris2.9
  system   sparc, solaris2.9
  status
  major1
  minor9.0
  year 2004
  month04
  day  12
  language R

 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.

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2005-01-01 Thread Liaw, Andy
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.

Andy

 From: Paul Roebuck
 
 On Sat, 1 Jan 2005, Liaw, Andy wrote:
 
   From: Paul Roebuck
  
   Wish to install a local source package on Un*x platform from
   within R. Same thing as I can accomplish from cmdline as
  
   $ export R_LIBS=~/R/library
   $ cd /path/to/pkg
   $ R CMD INSTALL -l $R_LIBS pkgname
  
  
   So, how do you go about this anyway?
   And isn't this a bug in 'install.packages'?
  
   ---
   $ R
  
   R : Copyright 2004, The R Foundation for Statistical Computing
   Version 1.9.0  (2004-04-12), ISBN 3-900051-00-3
  
file.pkg - mypkg_0.1.tar.gz
path.pkg - file.path(path.expand(~), cvknn, file.pkg)
file.exists(path.pkg)
   [1] TRUE
uri.pkg - paste(file://, path.pkg, sep = )
install.packages(contriburl = uri.pkg, lib = 
 Sys.getenv(R_LIBS))
   Error in file.info(x) : Object tmpd not found
traceback()
   4: file.info(x)
   3: dirTest(destdir)
   2: download.packages(pkgs, destdir = tmpd, available = available,
  contriburl = contriburl, method = method)
   1: install.packages(contriburl = uri.pkg, lib = 
 Sys.getenv(R_LIBS))
version
_
   platform sparc-sun-solaris2.9
   arch sparc
   os   solaris2.9
   system   sparc, solaris2.9
   status
   major1
   minor9.0
   year 2004
   month04
   day  12
   language R
 
  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.
 
 --
 SIGSIG -- signature too long (core dumped)
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2005-01-01 Thread Paul Roebuck
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)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2005-01-01 Thread Roger D. Peng
By the way, do you get this error in a recent version of R (say = 1.9.1).  I 
believe install.packages() has changed since 1.9.0.  For example, see the thread 
starting here

https://stat.ethz.ch/pipermail/r-help/2004-July/053001.html
-roger
Paul Roebuck wrote:
Wish to install a local source package on Un*x platform from
within R. Same thing as I can accomplish from cmdline as
$ export R_LIBS=~/R/library
$ cd /path/to/pkg
$ R CMD INSTALL -l $R_LIBS pkgname
So, how do you go about this anyway?
And isn't this a bug in 'install.packages'?
---
$ R
R : Copyright 2004, The R Foundation for Statistical Computing
Version 1.9.0  (2004-04-12), ISBN 3-900051-00-3

file.pkg - mypkg_0.1.tar.gz
path.pkg - file.path(path.expand(~), cvknn, file.pkg)
file.exists(path.pkg)
[1] TRUE
uri.pkg - paste(file://, path.pkg, sep = )
install.packages(contriburl = uri.pkg, lib = Sys.getenv(R_LIBS))
Error in file.info(x) : Object tmpd not found
traceback()
4: file.info(x)
3: dirTest(destdir)
2: download.packages(pkgs, destdir = tmpd, available = available,
   contriburl = contriburl, method = method)
1: install.packages(contriburl = uri.pkg, lib = Sys.getenv(R_LIBS))
version
 _
platform sparc-sun-solaris2.9
arch sparc
os   solaris2.9
system   sparc, solaris2.9
status
major1
minor9.0
year 2004
month04
day  12
language R
--
SIGSIG -- signature too long (core dumped)
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2005-01-01 Thread Paul Roebuck
On Sat, 1 Jan 2005, Roger D. Peng wrote:

 Paul Roebuck wrote:
  Wish to install a local source package on Un*x platform from
  within R. Same thing as I can accomplish from cmdline as
 
  $ export R_LIBS=~/R/library
  $ cd /path/to/pkg
  $ R CMD INSTALL -l $R_LIBS pkgname
 
 
  So, how do you go about this anyway?
  And isn't this a bug in 'install.packages'?
 
  ---
  $ R
 
  R : Copyright 2004, The R Foundation for Statistical Computing
  Version 1.9.0  (2004-04-12), ISBN 3-900051-00-3
 
 
 file.pkg - mypkg_0.1.tar.gz
 path.pkg - file.path(path.expand(~), cvknn, file.pkg)
 file.exists(path.pkg)
 
  [1] TRUE
 
 uri.pkg - paste(file://, path.pkg, sep = )
 install.packages(contriburl = uri.pkg, lib = Sys.getenv(R_LIBS))
 
  Error in file.info(x) : Object tmpd not found
 
 traceback()
 
  4: file.info(x)
  3: dirTest(destdir)
  2: download.packages(pkgs, destdir = tmpd, available = available,
 contriburl = contriburl, method = method)
  1: install.packages(contriburl = uri.pkg, lib = Sys.getenv(R_LIBS))
 
 version
 
   _
  platform sparc-sun-solaris2.9
  arch sparc
  os   solaris2.9
  system   sparc, solaris2.9
  status
  major1
  minor9.0
  year 2004
  month04
  day  12
  language R
 

 By the way, do you get this error in a recent version of R
 (say = 1.9.1). I believe install.packages() has changed
 since 1.9.0.  For example, see the thread starting here

 https://stat.ethz.ch/pipermail/r-help/2004-July/053001.html


Roger,

Thanks for that link which helped me diagnose the problem.
I observed the same error you observed (.../053047.html). Still
think it's kind of hinky to pass an uninitialized variable (tmpd)
to another method and count on it doing something though.

I wondered if something had changed as well, but noticed no change
glancing at the source for install.packages on 2.0.1 (OS X).
But underneath, the behavior was different since I got a
different error message which noted the lack of a PACKAGES
file. That was enough to get the rest to work...

Hopefully this will help my case for updating to the current
version on our shared Un*x workstations since I can now point
to a definitive bug that impacted my work due to using an
older version of this software.


R : Copyright 2004, The R Foundation for Statistical Computing
Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0

 parentdir - file.path(path.expand(~), Projects, cvknn)
 uri.parentdir - paste(file://, parentdir, sep = )
 savewd - getwd()
 setwd(parentdir)
 rmsymlink - FALSE
 if (file.exists(PACKAGES) == FALSE) {
 file.symlink(file.path(mypkg, DESCRIPTION), PACKAGES)
 rmsymlink - TRUE
 }
 install.packages(mypkg,
+  contriburl = uri.parentdir,
+  lib = Sys.getenv(R_LIBS))
 if (rmsymlink) file.remove(PACKAGES)
 setwd(savewd)

Perhaps the documentation for the 'contriburl' should
specify that it is expecting 'URL of the directory of
the contrib section of CRAN'.

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html