Hi Ron,

If all you want changed is the message, this seems like a cosmetic
issue.  If that is true, something like this may work where you just
send the unwanted messages to a temporary file and print your own:

require2 <- function(x) {
  junk <- file(file.path(tempdir(), "junk.txt"), open = "wt")
  sink(junk, type="message")
  eval(substitute(require(pkg), list(pkg = x)))
  sink(type="message")
  if (x == "vegan") {
    cat("The message I really want showing", fill = TRUE)
  }
}

require2("vegan")

You could rearrange so that it calls require() for most packages and
only does something special for the one package you want changed.

Cheers,

Josh

On Mon, Jan 16, 2012 at 11:30 AM, Ron Michael <ron_michae...@yahoo.com> wrote:
> Actually this is a paid package and developer was reluctant to distribute the 
> source. Therefore I was exploring whether I could do something by myself. So 
> you are talking about some tools. Are those tools available somewhere over 
> Net, or if it is not still available, is there any plan in any future from R 
> core team to build such one?
>
> Thanks,
>
>
> ----- Original Message -----
> From: Uwe Ligges <lig...@statistik.tu-dortmund.de>
> To: Ron Michael <ron_michae...@yahoo.com>
> Cc: "r-devel@r-project.org" <r-devel@r-project.org>
> Sent: Monday, 16 January 2012 6:14 PM
> Subject: Re: [Rd] How to modify the start-up message
>
>
>
> On 16.01.2012 12:20, Ron Michael wrote:
>> Thanks Uwe for you reply. However you used 'should' which brings some 
>> confusion to me! Did you mean that, **it is never possible** to modify those 
>> message given I only have windows binary?
>
> Actually, it may be possible (and I am not sure without reading the
> sources): One could read, implant and write back the databases, but we
> do not have the tools to do that easily, hence some work would be needed
> to find out. Anyway, it simply does not make sense to mess around given
> you just need to ask for the source package in order to change the stuff.
>
> Best,
> Uwe Ligges
>
>
>
>>
>> Thanks,
>>
>>
>> ----- Original Message -----
>> From: Uwe Ligges<lig...@statistik.tu-dortmund.de>
>> To: Ron Michael<ron_michae...@yahoo.com>
>> Cc: "r-devel@r-project.org"<r-devel@r-project.org>
>> Sent: Monday, 16 January 2012 12:03 AM
>> Subject: Re: [Rd] How to modify the start-up message
>>
>>
>>
>> On 12.01.2012 16:27, Ron Michael wrote:
>>> Hi all, I got a custom R package in .zip (i.e. meant only for Windows 
>>> installation). When I load that package, there are some start-up messages, 
>>> probably loading through .onLoad() function. However I want to modify those 
>>> messages. Please note that I do not have any other version of that package 
>>> like .tar.gz fomat etc.
>>>
>>> Having only the .zip version, is there any possibility to modify those 
>>> start-up functionalities of that package?
>>
>>
>> You should always modify packages by applying the changes to the source
>> package and reinstall that.  Hence ask those who provided the binary
>> package for a source version.
>>
>> Uwe Ligges
>>
>>
>>
>>
>>>
>>> Thanks for your help.
>>>
>>> ______________________________________________
>>> R-devel@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to