From |@g|ne @end|ng |rom p@@jd@org  Mon Jun 17 09:56:39 2019
From: |@g|ne @end|ng |rom p@@jd@org (=?iso-8859-1?Q?IAGO_GIN=C9_V=C1ZQUEZ?=)
Date: Mon, 17 Jun 2019 07:56:39 +0000
Subject: [Rd] Could generic functions check different S3 methods for an
 object when one of them produces an error?
Message-ID: <DB6PR02MB31272F107C5F54FE88D63B9592EB0@DB6PR02MB3127.eurprd02.prod.outlook.com>

Hi,


Let's say one has an object with multiple classes, and a generic function to apply to it has associated S3 methods for more than one of those classes. Further, the method it chooses (I do not know how; some order in the class vector?) is not the suitable one and it produces an error. Would there be some way to make the generic function to choice the correct method, or in case that for any method taken it produces an error, to try another one.


For example (commented in detail here<https://github.com/tidymodels/broom/issues/714>):


# object with multiple classes: the output of function `geepack::geeglm`. The output of `class(object)`:

```

[1] "geeglm" "gee" "glm" "lm"

```

The generic function: `stats::confint`.

The S3 method chosen: `confint.glm`. It produces an error. The correct method in this case would be `broom:::confint.geeglm`.


Thank you!

Iago

	[[alternative HTML version deleted]]



[Rd] Could generic functions check different S3 methods for an object when one of them produces an error?
=?iso-8859-1?Q?IAGO_GIN=C9_V=C1ZQUEZ?=