It is pkgType="source", not method="source". (What the default is on your platform depends on the version of R you are using: 'OS X' is presumably MacOS, but there are several different builds for MacOS with different defaults.)
If used as documented, install.packages() does install from package source tarballs on all platforms. So does R CMD INSTALL tarball.tar.gz. On Fri, 9 Dec 2005, Ken Termiso wrote: > I realize that others have struggled with this issue...i.e. > http://tolstoy.newcastle.edu.au/~rking/R/help/05/01/9826.html That's a long time ago: there have been three R releases since then with a fourth imminent. Package management changed a lot in 2.1.0 released in April 2005. The article in the May R-News should help. > i would like to be able to install downloaded source (tar.gz'd) files from > within an R session, and have it work in a X-platform way..i am often not > connected to the internet and have libraries that i would like to be able to > install in an automated way.. > > i've tried several things: > > 1) > install.packages("hs95av2hs3ug6cdf_6.0.0.tar.gz", repos=NULL, > method="source") > Error in gzfile(file, "r") : unable to open connection > In addition: Warning message: > cannot open compressed file 'hs95av2hs3ug6cdf_6.0.0.tar.gz/DESCRIPTION' > >> traceback() > 5: gzfile(file, "r") > 4: read.dcf(file.path(curPkg, "DESCRIPTION"), c("Package", "Version")) > 3: unpackPkg(pkgs[i], pkgnames[i], lib, installWithVers) > 2: .install.macbinary(pkgs = pkgs, lib = lib, contriburl = contriburl, > method = method, available = available, destdir = destdir, > installWithVers = installWithVers, dependencies = dependencies) > 1: install.packages("hs95av2hs3ug6cdf_6.0.0.tar.gz", repos = NULL, > method = "source") > > > 2) the code in the above thread doesn't work for me on OS X.. > file.pkg <- "hs95av2hs3ug6cdf_6.0.0.tar.gz" > path.pkg <- file.path(getwd(), file.pkg) > pkg_path <- paste("file://", path.pkg, sep = "") > install.packages("hs95av2hs3ug6cdf_6.0.0", contriburl=pkg_path, lib = > Sys.getenv("R_LIBS")) > > Error in gzfile(file, "r") : unable to open connection > In addition: Warning message: > cannot open compressed file > '/Users/ken/Desktop/hs95av2hs3ug6cdf_6.0.0.tar.gz/PACKAGES' > >> traceback() > 5: gzfile(file, "r") > 4: read.dcf(file = tmpf, fields = flds) > 3: available.packages(contriburl = contriburl, method = method) > 2: .install.macbinary(pkgs = pkgs, lib = lib, contriburl = contriburl, > method = method, available = available, destdir = destdir, > installWithVers = installWithVers, dependencies = dependencies) > 1: install.packages("hs95av2hs3ug6cdf_6.0.0", contriburl = pkg_path, > lib = Sys.getenv("R_LIBS")) > > > *with both of those, things get screwy with gzfile(), but calling it > directly on the file is fine.. > >> gzfile("hs95av2hs3ug6cdf_6.0.0.tar.gz") > description class > mode > "hs95av2hs3ug6cdf_6.0.0.tar.gz" "gzfile" > "rb6" > text opened > can read > "text" "closed" > "yes" > can write > "yes" > > > > > 3) i tinkered with the installLocalPackages() from sciViews library... > > "installLocalPackages" <- > > function(basedir = "d:/R", url = paste("file:", > > basedir, "/bin/windows/contrib", sep = "")) { > > # Install one or several packages from a local source > > if (.Platform$OS.type != "windows") > > stop("This function is for Windows only! Use install.packages > instead.") > > localurl <- (length(grep("^file:", url)) > 0) > > if (!localurl) > > stop("installLocalPackages can only install local packages. Use > install.packages to install accross the internet") > > a <- CRAN.packages(contriburl = url) > > pkgs <- select.list(a[, 1], , TRUE) > > if (length(pkgs) == 0 || pkgs[1] == "") # The user cancelled the list > > return(invisible(NULL)) > > lib <- .libPaths()[1] > > # Install those selected packages > > install.packages(pkgs, lib, CRAN = NULL) > > invisible() > > } > > > > this was my final version before i quit - > > "installLocalPackages" <- > > function(url = paste("file:/", > > basedir, sep = ""), basedir = file.path(getwd()), localPkg) { > > # Install one or several packages from a local source > > localurl <- (length(grep("^file:", url)) > 0) > > if (!localurl) > > stop("installLocalPackages can only install local packages. Use > install.packages to install accross the internet") > > # a <- available.packages(contriburl = url) > > # pkgs <- select.list(a[, 1], , TRUE) > > # if (length(pkgs) == 0 || pkgs[1] == "") # The user cancelled the list > > # return(invisible(NULL)) > > lib <- .libPaths()[1] > > # Install those selected packages > > install.packages(localPkg, lib, CRAN = NULL) > > invisible() > > } > > > > ideally, i would like to have installLocalPackages() work in a X-platform > way with NO gui; i would like it to accept either a single .tar.gz or > several at a time... > > any help would be much appreciated - i'm out of ideas... > > ______________________________________________ > 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 > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ 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