[R] installing packages from a directory on the computer

Peter Ehlers ehlers at ucalgary.ca
Tue Jun 22 19:40:55 CEST 2010


Okay, Subramanian S, try this:

pkgs <- c("pkg1", "pkg2", "pkg3")
install.packages(pkgs, repos = NULL,
                  contriburl = "file:///c:/r/repos/2.12",
                  dependencies = TRUE)

where I've got zipfiles in c:/r/repos/2.12.

Comments:
1. Note the 3 slashes after "file:".
2. You will also have to copy the file PACKAGES into
    your download folder.
3. Specify "lib=" if you don't want to install into the
    default directory.
4. You may get warnings about unavailable packages.

   -Peter Ehlers

On 2010-06-22 7:38, David Winsemius wrote:
>
> On Jun 22, 2010, at 5:48 AM, Subramanian S wrote:
>
>> Peter, i tried the file.choose() method of installing from local zip
>> files;
>> its easy to install few packages that way. but you see if there are many
>> packages(say >10 or 12), then i wont be able to install the packages on
>> which the packages that i want to install depend because i guess i
>> cant set
>> dependencies=TRUE by this method.
>>
>> here is what i tried
>> i replaced "http://my.local.cran" (code below) in Rprofile.site with
>> "file://C:/R/packages/" and then did
>>
>> install.packages(c("pkg1", "pkg2", ...),dependencies=TRUE) in R
>> console but
>> dint succeed..
>
> What were the error messages?
>
> (I would have guessed that you needed to specify that the packages
> should be installed from "source", since I think that the default might
> be "win.binary". The error messages should have been informative. Always
> include full error messages as the Posting Guide clearly states.)
>
>>
>> # set a CRAN mirror
>> local({r <- getOption("repos")
>> r["CRAN"] <- "http://my.local.cran/"
>> options(repos=r)})
>>
>> Would Appreciate help
>>
>> [[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.
>
> David Winsemius, MD
> West Hartford, CT
>



More information about the R-help mailing list