From ligges at statistik.tu-dortmund.de  Fri Feb 24 18:53:50 2012
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Fri, 24 Feb 2012 18:53:50 +0100
Subject: [Rd] Silently loading and Depends: versus NAMESPACE imports
In-Reply-To: <CAE9ddGDmME-c=M7zGwdAAMWjN+vD0gd_+ozjsRnNBCSV2Xr02A@mail.gmail.com>
References: <20237.58927.327444.422917@max.nulle.part>
	<4F0F3EC0.5060500@fhcrc.org>
	<20258.47943.798999.741944@max.nulle.part>
	<4F2419AE.5010203@statistik.tu-dortmund.de>
	<20260.7967.353013.815027@max.nulle.part>
	<CAE9ddGDo7rf9rm6tsRdfhx+C=JHiTWwDeyV8z3jUi-bzR8mkgg@mail.gmail.com>
	<4F460E03.1000604@statistik.tu-dortmund.de>
	<CAE9ddGCXf8J55mx=n4JZEyX3CXq0UB4rDzAjwJKCmVbhw-eroQ@mail.gmail.com>
	<20295.37272.595195.206946@max.nulle.part>
	<CAE9ddGAsqeoDGvcimckBQWwopRtqUVwE_wPr5Rg86b_f-cok2Q@mail.gmail.com>
	<4F47CB82.4030904@statistik.tu-dortmund.de>
	<CAE9ddGB=bnnPOWgCxFMcirSpwvrkwuGKGx_ybYDXPqge5+FfQQ@mail.gmail.com>
	<4F47CD97.30303@statistik.tu-dortmund.de>
	<CAE9ddGDmME-c=M7zGwdAAMWjN+vD0gd_+ozjsRnNBCSV2Xr02A@mail.gmail.com>
Message-ID: <4F47CEAE.7040601@statistik.tu-dortmund.de>



On 24.02.2012 18:52, Suraj Gupta wrote:
> My problem is the same problem that Dirk first asked about.  I want to
> reduce the verbose noise.  I want my Imports to not show any startup
> messages when I load my own package.

Are you going to pull me? Use suppressPackageStartupMessages()!

Uwe Ligges





>
> 2012/2/24 Uwe Ligges<ligges at statistik.tu-dortmund.de>
>
>>
>>
>> On 24.02.2012 18:48, Suraj Gupta wrote:
>>
>>> Correct, nothing happens in terms of startup messages.  No messages are
>>> shown.
>>>
>>> library( my package ) # Performance Analytics message shown
>>> search()  # PerformanceAnalytics is not in the search list since its in my
>>> Imports, not Depends
>>> suppressPackageStartupMessages****( library("PerformanceAnalytics"****))
>>> # no
>>>
>>> message are shown
>>> search() # PerformanceAnalytics is now in the seach list beneath R_Global
>>> as expected
>>>
>>
>>
>> OK, and can you please elaborate what is your problem finally?
>>
>> Uwe Ligges
>>
>>
>>
>>
>>> 2012/2/24 Uwe Ligges<ligges at statistik.tu-**dortmund.de<ligges at statistik.tu-dortmund.de>
>>>>
>>>
>>>
>>>>
>>>> On 24.02.2012 18:02, Suraj Gupta wrote:
>>>>
>>>>   Sorry, let me provide the details:
>>>>> My package has a .onAttach function (not a .onLoad).  The .onAttach
>>>>> constructs a startup message and delivers it via
>>>>> packageStartupMessage().
>>>>>   I've pasted the code below.  My package has a number of other packages
>>>>> in Depends and Imports.  Some of the packages in Imports have startup
>>>>> message (not R message, but package specific messages).
>>>>>
>>>>> For example I have PerformanceAnalytics in Imports and it shows:
>>>>> "Econometric tools for performance and risk analysis.
>>>>> ..."
>>>>>
>>>>>
>>>>
>>>> And nothing happenms once you start it via
>>>>
>>>>   suppressPackageStartupMessages****( library("PerformanceAnalytics"**
>>>> **))
>>>>
>>>> right?
>>>>
>>>> Uwe Ligges
>>>>
>>>>
>>>>   googoleVis shows:
>>>>> "Please read the Google Visualisation&    Maps API Terms of Use
>>>>>
>>>>> before you use the package:
>>>>> ..."
>>>>>
>>>>> my .onAttach is pretty simple:
>>>>> .onAttach<- function(...)
>>>>> {
>>>>>      mylib = dirname( system.file( package = "spear" ) )
>>>>>      ver   = packageDescription( "spear" , lib = mylib )$Version
>>>>>      builddate = packageDescription( "spear" , lib = mylib )$Date
>>>>>      startupMessage = ""
>>>>>      startupMessage = paste( startupMessage , "\n\n\n" , sep = "" )
>>>>>      startupMessage = paste( startupMessage ,
>>>>> "-----------------------------****----------------------------**--**
>>>>> ------------------------------****---------------------------\**n"
>>>>>
>>>>> , sep = "" )
>>>>>      startupMessage = paste( startupMessage , "SPEAR\n" , sep = "" )
>>>>>      startupMessage = paste( startupMessage , paste( "(Version " , ver ,
>>>>> ",
>>>>> built: " , builddate , ")\n\n" , sep = "" ) , sep = "" )
>>>>>      startupMessage = paste( startupMessage , "MY MESSAGE HERE...left out
>>>>> for brevity" , sep = "" )
>>>>>      packageStartupMessage( startupMessage )
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Feb 24, 2012 at 8:33 AM, Dirk Eddelbuettel<edd at debian.org>
>>>>>   wrote:
>>>>>
>>>>>
>>>>>   On 24 February 2012 at 00:27, Suraj Gupta wrote:
>>>>>> | I don't think that is it.  My startup message is currently in
>>>>>> .onAttach
>>>>>> and I
>>>>>> | still see startup message from packages that I have moved from
>>>>>> Imports
>>>>>> to
>>>>>> | Depends.
>>>>>> | Dirk?
>>>>>>
>>>>>> There are / were are few issues intertwined in my case, and yours may
>>>>>> differ:
>>>>>>
>>>>>>   - are the messages from your code / packages and you startup messages
>>>>>> ?
>>>>>>
>>>>>>   - are they from imported packages ?
>>>>>>
>>>>>>   - are they from R (reported 'foo being shadowed' or 'generic bar
>>>>>> defined')
>>>>>>
>>>>>> In my case a combination of using .onAttach and .onLoad (instead of
>>>>>> just
>>>>>> .onLoad) together with import directives in a NAMESPACE file solved the
>>>>>> issue, as had been suggested on this list.
>>>>>>
>>>>>> Dirk
>>>>>>
>>>>>> --
>>>>>> "Outside of a dog, a book is a man's best friend. Inside of a dog, it
>>>>>> is
>>>>>> too
>>>>>> dark to read." -- Groucho Marx
>>>>>>
>>>>>>
>>>>>>          [[alternative HTML version deleted]]
>>>>>
>>>>>
>>>>> ______________________________****________________
>>>>> R-devel at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/****listinfo/r-devel<https://stat.ethz.ch/mailman/**listinfo/r-devel>
>>>>> <https://**stat.ethz.ch/mailman/listinfo/**r-devel<https://stat.ethz.ch/mailman/listinfo/r-devel>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>



[Rd] Silently loading and Depends: versus NAMESPACE imports
Uwe Ligges