-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha.R
More file actions
43 lines (37 loc) · 772 Bytes
/
a.R
File metadata and controls
43 lines (37 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#' An S7 generic
#'
#' @param x,y A parameter
#' @export
s7_method <- S7::new_generic("s7_method", "x")
#' @rdname s7_method
S7::method(s7_method, S7::class_integer) <- function(x, ...) x
#' S7 character method
#'
#' @rdname s7-method-2
S7::method(s7_method, S7::class_character) <- function(x, ...) x
#' An S7 multi-dispatch generic
#'
#' @param x,y A parameter
#' @export
s7_multi <- S7::new_generic("s7_multi", c("x", "y"))
#' @rdname s7_multi
S7::method(s7_multi, list(S7::class_integer, S7::class_character)) <- function(
x,
y,
...
) {
x
}
#' S7 multi-dispatch method
#'
#' @rdname s7-multi-2
S7::method(s7_multi, list(S7::class_character, S7::class_integer)) <- function(
x,
y,
...
) {
y
}
.onLoad <- function(...) {
S7::methods_register()
}