Hi,
On Mon, Jul 9, 2012 at 2:30 PM, Hui Du <Hui.Du at 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