Re: [Rd] Silently loading and Depends: versus NAMESPACE imports

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Fri, 24 Feb 2012 18:40:18 +0100

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



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 24 Feb 2012 - 17:44:48 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 24 Feb 2012 - 18:10:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive