From Thorn.Thaler at rdls.nestle.com  Mon Feb 13 12:59:37 2012
From: Thorn.Thaler at rdls.nestle.com (Thaler,Thorn,LAUSANNE,Applied Mathematics)
Date: Mon, 13 Feb 2012 12:59:37 +0100
Subject: [Rd] Overwrite S3 methond from base package
Message-ID: <F54EF8F1B477CF448729593FE421F6466EDD5A@HQVEVE0032.nestle.com>

Dear all,

I am developing a package, which bundles my most frequently used
functions. One of those is a modified version of droplevels from the
base package (basically, it preserves any contrast function which was
used to create the factor, contrast matrices are not kept, for they
could be wrong if a level is dropped).

In my NAMESPACE file I've the following directives, which should export
my methods:

S3method(droplevels, factor)
S3method(droplevels, data.frame)

However, when I load my package and I try to use those functions, the
dispatching mechanism calls the functions droplevels.factor and
droplevels.data.frame from the _base package_.

So, is there any way to overwrite droplevels.factor and
droplevels.data.frame from the base package with my functions? Or do I
have to create a generic function on my own?

Thanks for your help.

Kind Regards,

Thorn



[Rd] Overwrite S3 methond from base package
Thaler,Thorn,LAUSANNE,Applied Mathematics