Thanks Sarah. I realized it as well and tried to run install.packages("plyr", lib = .Library) as root. It works now.
Thanks again. HXD -----Original Message----- From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: Monday, July 09, 2012 12:06 PM To: Hui Du Cc: r-help@r-project.org Subject: Re: [R] install.packages Hi, On Mon, Jul 9, 2012 at 2:30 PM, Hui Du <hui...@dataventures.com> wrote: > > Hi All, > > I have two questions regarding install.packages(). > > Q1: may I run it in non-interactive mode, which means just install the > packages I want rather than letting me to choose which mirror etc? Sure. If you read ?install.packages you'll see the possible arguments, which include specifying which mirror to use rather than waiting to be asked. > Q2: I ran a R code in batch mode, for example, R CMD BATCH a.r > > In a.r, I have some statements like > > packages = library()$result[, "Package"]; > > f(! "plyr" %in% packages) > { > install.packages("plyr"); > } > > I ran a.r in UNIX machine, when I logged in as a user, say 'abc', the system > found 'plyr' is not there and then tried to install it. If I logged in as > another user, say '123', the system found 'plyr' is not there and then tried > to install it. My question is to how to make sure to install 'plyr' just once > rather than depending on the 'user'. Only root can install packages for the entire system, rather than in a user's local directory. I find it most convenient to install a whole bunch of packages at once as root by using task views. Then they're available for all users of the system. Sarah -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ 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.