[R] How to figure out which the version of split is used?

Peng Yu pengyu.ut at gmail.com
Thu Dec 10 20:56:12 CET 2009


On Thu, Dec 10, 2009 at 3:46 AM, Karl Ove Hufthammer <karl at huftis.org> wrote:
> On Wed, 9 Dec 2009 19:20:47 -0600 Peng Yu <pengyu.ut at gmail.com> wrote:
>> Is there a way to figure out which of these variants is actually
>> dispatched to when I call split? I know that if the argument is of the
>> type data.frame, split.data.frame will be called? Is it the case that
>> if the argument is not of type data.frame, Date or POSIXct,
>> split.default will be called?
>
> Yes. See ?UseMethod

I tried it. But I'm not sure how to use it. Would you please give me a
working example?

> UseMethod('print')
Error in UseMethod("print") :
  'UseMethod' used in an inappropriate fashion
> UseMethod('print', 1:2)
Error in UseMethod("print", 1:2) :
  'UseMethod' used in an inappropriate fashion




More information about the R-help mailing list