Nothing
Code
method(foo, class_character) <- (function(x) "c")
method(foo, class_character) <- (function(x) "c")
Message
Overwriting method foo(<character>)
Code
method(sum, new_S3_class("foo")) <- (function(x, ...) "foo")
Condition
Error:
! When registering methods for S3 generic sum(), signature must be an S7 class, not an S3 class.
Class has not been registered with S4; please call S4_register(S4foo)
Code
x <- 10
method(x, class_character) <- (function(x) ...)
Condition
Error:
! `generic` must be a function, not a <double>
Code
method(foo, 1) <- (function(x) ...)
Condition
Error:
! Can't convert `signature` to a valid class. Class specification must be an S7 class object, the result of `new_S3_class()`, an S4 class object, or a base class, not a <double>.
Code
as_signature(list(1), foo)
Condition
Error:
! Can't convert `signature` to a valid class. Class specification must be an S7 class object, the result of `new_S3_class()`, an S4 class object, or a base class, not a <list>.
Code
as_signature(class_character, foo)
Condition
Error:
! `signature` must be a list for multidispatch generics
Code
as_signature(list(class_character), foo)
Condition
Error:
! `signature` must be length 2
Code
foo <- new_generic("foo", "x")
check_method(1, foo)
Condition
Error:
! foo(???) must be a function
Code
check_method(function(y) { }, foo)
Condition
Error:
! foo() dispatches on `x`, but foo(???) has arguments `y`
Code
check_method(function(x = "foo") { }, foo)
Condition
Error:
! In foo(???), dispatch arguments (`x`) must not have default values
Code
check_method(function(x, y, ...) { }, foo)
Code
foo <- new_generic("foo", "x", function(x) S7_dispatch())
check_method(function(x, y) { }, foo)
Condition
Error:
! foo() generic lacks `...` so method formals must match generic formals exactly.
- generic formals: foo(x)
- method formals: foo(x, y)
Code
foo <- new_generic("foo", "x", function(x, ..., z = 2, y = 1) S7_dispatch())
check_method(function(x, ..., y = 1) { }, foo)
Condition
Warning:
foo(???) doesn't have argument `z`
Code
check_method(function(x, ..., y = 1, z = 1) { }, foo)
Condition
Warning:
In foo(???), default value of `z` is not the same as the generic
- Generic: 2
- Method: 1
Code
method(foo, list(class_integer, class_integer))
Output
<S7_method> method(foo, list(class_integer, class_integer))
function (x, y, ...)
paste0("bar:", x, y)
<environment: 0x0>
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.