• Files
  • Source
1
#' an example function
2
#'
3
#' @export
4
#' @examples
5
#' a(1)
6
a <- function(x) {
7
  if (x <= 1) {
5x
8
    1
2x
9
  } else {
10
    2
3x
11
  }
12
}
13

                    
14
#' @export
15
TestS4 <- setClass("TestS4", # nolint
16
  slots = list(name = "character", enabled = "logical"))
17

                    
18
#' @export
19
setGeneric("print2", function(x, y) {
20
})
21

                    
22
setMethod("print2",
23
  c(x = "TestS4"),
24
  function(x) {
25
    1 + 1
1x
26
  })
27

                    
28
setMethod("print2",
29
  c(x = "TestS4", y = "character"),
30
  function(x, y) {
31
    1 + 2
1x
32
  })
33

                    
34
setMethod("show",
35
  c(object = "TestS4"),
36
  function(object) {
37
    1 + 3
1x
38
  })