On 07/15/2013 06:25 AM, Duncan Murdoch wrote:
On 15/07/2013 8:49 AM, Andreas Leha wrote:
Hi Helios,
"Helios de Rosario" <helios.derosa...@ibv.upv.es> writes:
>> Hi all,
>>
>> several packages print messages during loading. How do I avoid to
> see
>> them when the packages are in the defaultPackages?
>>
>> Here is an example.
>>
>> With this in ~/.Rprofile
>> ,----[ ~/.Rprofile ]
>> | old <- getOption("defaultPackages")
>> | options(defaultPackages = c(old, "filehash"))
>> | rm(old)
>> `----
>>
>> I get as last line when starting R:
>> ,----
>> | filehash: Simple key-value database (2.2-1 2012-03-12)
>> `----
>>
>> Another package with (even more) prints during startup is
> tikzDevice.
>>
>>How can I avoid to get these messages?
>
>
> There are several options in ?library to control the messages that are
> displayed when loading packages. However, this does not seem be able to
> supress all the messages. Some messages are defined by the package
> authors, because they feel necessary that the user reads them.
>
Thanks for your answer. When I actually call library() or require()
myself I can avoid all messages. There are hacks to do that even for
the very persistent messages [fn:1].
My question is how to suppress these messages, when it is not me who
calls library() or require(), but when the package is loaded during R's
startup through the defaultPackages option.
You could try the --slave command line option on startup. If that isn't
sufficient, try getting the maintainer to change the package behaviour, or do it
yourself.
In a hack-y way ?setHook and ?sink seem to work
> setHook(packageEvent("filehash", "onLoad"), function(...)
sink(file(tempfile(), "w"), type="message"))
> setHook(packageEvent("filehash", "attach"), function(...) sink(file=NULL,
type="message"), "append")
> library(filehash)
>
Martin
Duncan Murdoch
______________________________________________
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.
--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109
Location: Arnold Building M1 B861
Phone: (206) 667-2793
______________________________________________
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.