-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect the package that is needed to create or predict a model object #849
Comments
If the object is an S3 object, this should work --
If the object is S4 (eg, from lme4) --
|
@bwiernik Thanks for your suggestions. I will try to test them soon when I have a free moment. Could such functionality be integrated as a function in the package? |
Can you say more about the use case? If you have the package to fit the model, then the package should certainly be available to supply its methods |
@bwiernik, the context is parallel processing with my So, for example, when my The current version of my code requires users to specify a So, I think that my use case could be generalized to parallel processing when the source package of certain complex objects (in my case, models) needs to be detected. |
@bwiernik Thanks; I have now implemented this check for S3 objects in my package and it now automatically detects and loads the appropriate packages. I don't understand the S4 check code you gave (probably because I rarely work with S4 objects), so my package is now configured to automatically check for the S3 package and then give a graceful error message if it cannot be detected. Then users can explicitly specify the packages with my existing manual mechanism. That is acceptable, since it should work automatically for most users and only require manual intervention for a few complicated cases. Would it be feasible to incorporate such a check into the Regardless, I appreciate your help. Your little S3 code has let me simplify my function usage for most users. |
R has two widely used class systems—S3 and S4 (and several less-used ones). S3 is most widely used, but some major modeling packages do use S4 (lme4 and OpenMx are the first ones that come to mind). The function |
But you specified the name of the S4 class in the code. I am not sufficiently familiar with S4 to convert this to code where I have an object of undetermined type and then probe its namespace (as with your S3 snippet above). |
Oh sorry
|
Hello. First, thanks for your fantastic package that I only recently discovered. It has really simplified some really tricky parts of my
ale
package.One thing I would like to be able to do is to detect the package that is needed to create or predict a model object. For example, if I give the
{insight}
package agam
model object, I would like it to tell me that this object was created using the{mgcv}
package. Is this possible with{insight}
?The text was updated successfully, but these errors were encountered: