You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
R6 has a nifty feature where you can add new members to an existing class via set(). You can even do this to a class exported by a different package, which is very useful indeed.
# modifying objects exported by another package must be done at runtime.onLoad<-function(libname, pkgname)
{
A::myclass$set("public", "g", overwrite=TRUE,
function(y) { ... }
}
Now you can do something like
library(A)
library(B)
obj<-A::myclass$new(...)
obj$g(y=42) # method defined by package B
How should we document the new method added by B?
The text was updated successfully, but these errors were encountered:
R6 has a nifty feature where you can add new members to an existing class via
set()
. You can even do this to a class exported by a different package, which is very useful indeed.For example, in package A:
And in package B:
Now you can do something like
How should we document the new method added by B?
The text was updated successfully, but these errors were encountered: