suppress startup messages from default packages

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

suppress startup messages from default packages

Andreas Leha
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?

Regards,
Andreas

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: suppress startup messages from default packages

Helios de Rosario
> 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.

Helios De Rosario

> Regards,
> Andreas


INSTITUTO DE BIOMECÁNICA DE VALENCIA
Universidad Politécnica de Valencia • Edificio 9C
Camino de Vera s/n • 46022 VALENCIA (ESPAÑA)
Tel. +34 96 387 91 60 • Fax +34 96 387 91 69
www.ibv.org

  Antes de imprimir este e-mail piense bien si es necesario hacerlo.
En cumplimiento de la Ley Orgánica 15/1999 reguladora de la Protección
de Datos de Carácter Personal, le informamos de que el presente mensaje
contiene información confidencial, siendo para uso exclusivo del
destinatario arriba indicado. En caso de no ser usted el destinatario
del mismo le informamos que su recepción no le autoriza a su divulgación
o reproducción por cualquier medio, debiendo destruirlo de inmediato,
rogándole lo notifique al remitente.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: suppress startup messages from default packages

Andreas Leha
Hi Helios,

"Helios de Rosario" <[hidden email]> 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.

Regards,
Andreas

Footnotes:

[fn:1] http://stackoverflow.com/a/8143671/1844418

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: suppress startup messages from default packages

Duncan Murdoch-2
On 15/07/2013 8:49 AM, Andreas Leha wrote:

> Hi Helios,
>
> "Helios de Rosario" <[hidden email]> 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.

Duncan Murdoch

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: suppress startup messages from default packages

Martin Morgan
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" <[hidden email]> 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
>
> ______________________________________________
> [hidden email] 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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: suppress startup messages from default packages

David Winsemius
In reply to this post by Andreas Leha

On Jul 15, 2013, at 4:11 AM, Andreas Leha wrote:

> Hi all,
>
> several packages print messages during loading.  How do I avoid to see
> them when the packages are in the defaultPackages?

I'm pretty sure this has been asked before (although the wrinkle of adding a package to default packages may not have been part of that discussion.)  Have you done any searching of the Archives?

>
> 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?

On my machine typing suppress<tab> brings up an option of:

 suppressPackageStartupMessages

You should append a leading "?" and read further.

--
David Winsemius
Alameda, CA, USA

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: suppress startup messages from default packages

Andreas Leha
Hi David,

David Winsemius <[hidden email]> writes:

> On Jul 15, 2013, at 4:11 AM, Andreas Leha wrote:
>
>> Hi all,
>>
>> several packages print messages during loading.  How do I avoid to see
>> them when the packages are in the defaultPackages?
>
> I'm pretty sure this has been asked before (although the wrinkle of
> adding a package to default packages may not have been part of that
> discussion.)  Have you done any searching of the Archives?
>>
>> 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?
>
> On my machine typing suppress<tab> brings up an option of:
>
>  suppressPackageStartupMessages
>
> You should append a leading "?" and read further.

I have only just now gotten your answer.  Thanks for responding.

As I already said in response to another message [fn:1] the 'wrinkle of
adding a package to default packages' is what my question really is
about.  Sorry if I was unclear.

Thanks to a very helpful answer proposing a solution using hooks [fn:2],
I was actually able to solve my 'problem' with the filehash package.

Regards,
Andreas


Footnotes:

[fn:1] http://permalink.gmane.org/gmane.comp.lang.r.general/296275

[fn:2] http://permalink.gmane.org/gmane.comp.lang.r.general/296281

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: suppress startup messages from default packages

Andreas Leha
In reply to this post by Martin Morgan
Hi Martin,

Martin Morgan <[hidden email]> writes:

> 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" <[hidden email]> 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


Thanks a lot for this really helpful answer!  Even if that is hack-y, I
am using this now and it solves my 'problem' with the filehash package.

Regards,
Andreas

______________________________________________
[hidden email] 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.