Hi all, I try to develop my own R package. I have a couple of standart functions like dim() and length() overloaded. #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? Thanks for your ideas. Vaclav ************************************************ _____ /_____-_\ http://www.kratochvil.biz [] \o\ _|_ /o/ [] email: Vaclav@Kratochvil.biz " ICQ: 112443571 ************************************************ [[alternative HTML version deleted]]
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, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
V?clav Kratochv?l wrote:> Hi all, > > I try to develop my own R package. I have a couple of standart functions like dim() and length() overloaded. > > #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?You don't want to hide this message. It is telling you that you have a variable in your user workspace that is hiding the one in your package. You probably want to delete the one in your workspace. By the way, questions about package writing really belong more on the R-devel list. Duncan Murdoch