Hello everyone! if we define some S3 method in some environment like this
E <- new.env() evalq({ test <- function(x) UseMethod("test") test.character <- function(x) 1 }, envir = E) this works evalq(test("a"), envir = E) but this doesn’t: attach(E) test("a") According to some remarks this now requires the use of .S3method to register the method to a method data base. This does work, but if we create two different environments with different implementations of the same S3 method this will always default to the last defined method (as the method data base is only updated on declaration). This makes a workflow where we use environments to enable and disable certain functions impossible. So I want to ask if there is currently any way to use S3 methods in a currently attached environment while allowing to switch the method by attaching a different environment? Kind Regards, Valentin
signature.asc
Description: This is a digitally signed message part.
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.