Skip to content
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

Implementing a base generic function for an S4 class #1785

Open
pvanlaake opened this issue Apr 5, 2024 · 0 comments
Open

Implementing a base generic function for an S4 class #1785

pvanlaake opened this issue Apr 5, 2024 · 0 comments

Comments

@pvanlaake
Copy link

pvanlaake commented Apr 5, 2024

When implementing a base generic function for an S4 class in a package, the function definition of the generic has to be located in the same R script (file) as the class definition. If not, the following warning (?) be generated when building or loading the function:

> devtools::load_all(".")
ℹ Loading myPackage
in method for ‘format’ with signature ‘"myS4class"’: no definition for class “myS4class”

Strangely enough, devtools::check() issues the warning at the beginning of its run, but it will not flag it as an error or a warning as it finishes. The code also runs without problem and performs as expected.

I trawled through the internet looking for answers, including your excellent books, but came up with nothing. (I finally figured it out myself.) You might want to note this in chapter 15, for instance right after the show() method in section 15.4.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant