Skip to content
Prev 46801 / 63424 Next

Capture output of install.packages (pipe system2)

On 13-09-23 6:34 PM, Simon Urbanek wrote:
Brian Ripley's reply describes how it is done in the tools package.  For 
example, as I sent privately to Jeroen,

x <- system2("Rscript", "-e \"install.packages('MASS',
repos='http://probability.ca/cran')\"", stdout=TRUE, stderr=TRUE)

captures all of the output from installing MASS.  As Jeroen pointed out, 
that isn't identical to running install.packages() in the current 
session; a real version of it should fill in more of the arguments, not 
leave them at their defaults.

Duncan Murdoch