On 15.09.2011 10:34, Søren Højsgaard wrote:
I have created an R-package with datasets which I want my students to install
(the package is not on CRAN).
1) I've put the package on the web in a directory called 'data' and I thought I
could do:
install.packages("http://gbi.agrsci.dk/statistics/courses/2011-ISMLS-course/data/LiSciData_0.0-03.tar.gz",repos=NULL,type="source")
Warning: invalid package
'http://gbi.agrsci.dk/statistics/courses/2011-ISMLS-course/data/LiSciData_0.0-03.tar.gz'
Error: ERROR: no packages specified
Warning messages:
1: running command 'C:/programs/R/current/bin/i386/R CMD INSTALL -l
"C:/programs/R/current/library"
"http://gbi.agrsci.dk/statistics/courses/2011-ISMLS-course/data/LiSciData_0.0-03.tar.gz"'
had status 1
2: In
install.packages("http://gbi.agrsci.dk/statistics/courses/2011-ISMLS-course/data/LiSciData_0.0-03.tar.gz",
:
installation of package
'http://gbi.agrsci.dk/statistics/courses/2011-ISMLS-course/data/LiSciData_0.0-03.tar.gz'
had non-zero exit status
Right, install.packages assumes a package name or a file path. URLs (or
any othr connections) are not supported.
2) I've then put the package in data/src/contrib/ and try:
install.packages('LiSciData_0.0-03.tar.gz',repos='http://gbi.agrsci.dk/statistics/courses/2011-ISMLS-course/data/',
type='source')
Warning: unable to access index for repository
http://gbi.agrsci.dk/statistics/courses/2011-ISMLS-course/data/src/contrib
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘LiSciData_0.0-03.tar.gz’ is not available (for R version 2.13.1)
If you want to use it as a repository, you have to make such a
repository. For a source repository, create subdirs ./src/contrib and
put your package there. Afterwards, you can run tools::write_PACKAGES on
that directory in order to create PACKAGES and PACKAGES.gz files for
that repository.
3) If I put the package in the Rs working directory then the following works:
install.packages("LiSciData_0.0-03.tar.gz",repos=NULL,type="source")
Right, hence you can also tell your students to:
download.file("http://gbi.agrsci.dk/statistics/courses/2011-ISMLS-course/data/LiSciData_0.0-03.tar.gz",
tempdir())
install.packages(file.path(tempdir(), 'LiSciData_0.0-03.tar.gz'),
repos=NULL, type='source')
Best wishes,
Uee
I would much prefer if it could be done directly from the web in the spirit of
attempt 1) above (because then fewer things can go wrong for the students). Any
hint on what I am doing wrong? sessionInfo() shown below.
Regards
Søren
sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252
LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C
LC_TIME=Danish_Denmark.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] SHDtools_1.0
loaded via a namespace (and not attached):
[1] tools_2.13.1
______________________________________________
R-help@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.
______________________________________________
R-help@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.