[R] Silencing the output of install.packages()

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Jun 2 15:25:00 CEST 2012


On 01/06/2012 08:46, Uwe Ligges wrote:
>
>
> On 01.06.2012 07:17, Tejas Kale wrote:
>> Dear Uwe
>>
>> Many thanks for your reply. I agree with you but I need the silencing of
>> output for a particular reason.
>>
>> I am working on a statistical package called VOStat which uses a Java
>> based
>> GUI to get the data and parameters of the test to be executed from the
>> user, creates the appropriate R script for it, runs it, and prints the
>> output given by R. For a particular test, if the required library is not
>> installed, the same is done dynamically without requiring any user input.
>> Now the problem I face is as follows:- Suppose the user requires a
>> correlation matrix of selected variables along with their p-values. For
>> this, I use the 'rcorr' function of the library 'Hmisc'. If the user does
>> not have 'Hmisc' available in his machine, it is automatically installed
>> for him. Once the installation is done, the library is loaded and 'rcorr'
>> is used for the necessary computation. But since I am presenting the
>> entire
>> output generated by the R script (which has the install function as
>> well),
>> along with the correlation matrices, the user of VOStat also gets to see
>> the output of 'install.packages()', something I want to avoid.
>>
>> Could please suggest a workaround that could be used to get rid of the
>> output?
>
>
> You could try to sink() into some null device, if that does not interact
> with the GUI you are using.

Unfortunately we don't know what platform the OP is talking about, as he 
persistently ignores the posting guide.

With a source-package install there will be several processes involving 
that are likely to write to stdout or stderr (the C file handles, not 
the R connections), and sink() does not re-direct those.

I would expect sink() or capture.output() to work for a binary package 
install (except for diagnostic messages which the user probably needs to 
see: you can with case sink the R message connection).

> Best,
> Uwe Ligges
>
>
>
>> Thanks
>> Tejas
>>
>>
>>
>> On Thursday 31 May 2012 08:00 PM, Uwe Ligges wrote:
>>
>> On 31.05.2012 16:18, Tejas Kale wrote:
>>
>> Hello!
>>
>> Is there a way to suppress the output of 'install.packages()'? I have
>> seen that the 'download.file' function has a 'quiet' option but I do
>> not know how to use it.
>>
>>
>> I do not see any good reason to allow that. A user shoudl see if software
>> is being installed.

>>
>> Uwe ligges
>>
>>
>>
>> Thanks for your help
>>
>> Tejas Kale
>> IUCAA, Pune
>>
>> ______________________________________________
>> 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.
>>
>
> ______________________________________________
> 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.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list