-
Notifications
You must be signed in to change notification settings - Fork 36
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
class(S7_object) is behaving oddly since S7 v0.2.0 #491
Comments
Yes, this was documented before, but it's now done automatically: when you have an S7 class in a package, you should use the package argument to automatically namespace the class. (This ensures that if some other package also defines a To determine if an object inherits from a specific S7 class you can use either How are you defining methods? |
Thanks so much for your help. I'm a biologist that knows just enough to be dangerous to myself, and obnoxious to you. I've gone through my code changing the previous I did have saved objects in I had to make the The generics/methods I have created now also work correctly, so I think the problems are all solved. For full documentation here, the changes made were:
Thanks so much, I'll close for now. Still wrapping my head around OOP in R, but getting the hang of it. |
FWIW you should supply the class object to |
Sorry for the title - it can be edited once I know the terms for the problem I am experiencing.
I have an S7 object (called
qsip_source_data
) that is defined as part of an R package calledqSIP2
. Instances of this object that I have created and saved as .rds before S7 v0.2.0 give what I consider the correct output when runningclass()
on them. New object, however, have the object name prepended withqSIP2::
when runningclass()
, which is changing behavior.This is making various aspects of my package break because I check for whether an object is the correct type with a statement like...
... and this is stopping everytime on new objects with the full
qSIP2::qsip_source_data
as one of the classes. I can't seem to make a reproducible example because this seems specific to an S7 object defined in a package, which I assume is where theqSIP2::
is coming from.So, I guess two questions come to mind...
"qsip_source_data" %in% class(X)
to verify an object is of the right class that won't break here?Additionally, and this might be its own issue, but methods are also not working correctly anymore and I get errors that methods don't exist for
<qsip_source_data>
. But, I can't seem to define them for<qSIP2::qsip_source_data>
as I get an error.Thanks for your help.
The text was updated successfully, but these errors were encountered: