-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
When defining S7 classes and methods, the order matters whereas typically this is not the case.
For example, in types.R I have a Todo definition
Todo <- S7::new_class(
"Todo",
properties = list(
...
),
)In data-frame-methods.R I have a method defined:
method(as.data.frame, Todo) <- function(x, ...) {
data.frame(
...
)
}This causes an error when using devtools::load_all()
Error in `load_all()`:
! Failed to load R/data-frame-methods.R
Caused by error:
! object 'Todo' not found
I believe this is because of the collation order putting data-frame-methods.R before types.R. The fix is to either change the file names or to put the method definition after the class definition.
Perhaps recommendations can be made in "Generics and methods"?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels