Assuming the R packages have been downloaded locally and end with tar.gz, then how about simply changing to where the files are located and typing the following command?
ls *.tar.gz | while read x; do echo "R CMD INSTALL $x"; done | bash Alternatively, you can use the install.packages() function in R. Regards, Adai Kermit Short wrote: > Dirk- > Many thanks for your reply. As I mentioned, I know very little > about programming in 'R' and what I've got is a BASH script. If needs be, > I'll look up how to read in a text file through R and add that into your > script in lieu of the (argv) stuff, but you wouldn't happen to know how to > accomplish the same thing using the > > R CMD INSTALL > > Shell command? > > Thanks! > > -Kermit > > -----Original Message----- > From: Dirk Eddelbuettel [mailto:[EMAIL PROTECTED] > Sent: Monday, May 21, 2007 12:00 PM > To: [EMAIL PROTECTED] > Cc: r-help@stat.math.ethz.ch > Subject: Re: [R] Installing packages from command line on Linux RHEL4 > > > Hi Kernit, > > On 21 May 2007 at 11:37, Kermit Short wrote: > | Greetings. > | > | I am a System Administrator, and thus have very little knowledge of R > | itself. I have been asked to install a list of some 200 packages (from > | CRAM) to R. Rather than installing each package manually, I was hoping I > | could script this. I've written a BASH script that hopefully will do > this, > | but I'm wondering about the Mirror Selection portion of the installation > | process. I've looked and can't find anywhere a parameter to supply that > | specifies a mirror to use so that I don't have to manually select it for > | each package I want to install. In this case, with nearly 200 packages to > | install, this could become quite tedious. Does anyone have any > | suggestions? > > The narrow answer is try adding > > repos="http://cran.us.r-project.org" > > Also, and if I may, the littler front-end (essentially "#!" shebang support > for R) > helps there: > > basebud:~> cat bin/installPackages.r > #!/usr/bin/env r > # > # a simple example to install all the listed arguments as packages > > if (is.null(argv)) { > cat("Usage: installPackages.r pkg1 [pkg2 [pkg3 [...]]]\n") > q() > } > > for (pkg in argv) { > install.packages(pkg, lib="/usr/local/lib/R/site-library", depend=TRUE) > } > > You would still need to add repos="..." there. I tend to do that in my > ~/.Rprofile. > > Hth, Dirk > ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.