Re: [R] Overload standart function

From: Prof Brian Ripley <>
Date: Fri 15 Apr 2005 - 07:01:37 EST

On Thu, 14 Apr 2005, [iso-8859-2] Václav Kratochvíl wrote:

> I try to develop my own R package. I have a couple of standart functions
> like dim() and length() overloaded.

Hmm. Not with the name dim.Model. You have defined an S3 method for class "Model", possibly not intentionally, and without following the rules set out in `Writing R Extensions'.

> #Example
> dim.Model <- function(this) {
> length(unique(this$.variables));
> }
> I built my package, but when I try to load it... This message appears:
> Attaching package 'mudim':
> The following object(s) are masked _by_ .GlobalEnv :
> dim.Model,...(etc.)
> Any idea, how to hide this message?

See ?library, which has an argument warn.conflicts, and that tells you how to do this on a per-package basis.

However, the problem appears to be that you don't want the copies in workspace (.GlobalEnv), which should be easy to fix.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list PLEASE do read the posting guide!

Received on Fri Apr 15 07:06:40 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:11 EST