super: Giving R the ability to invoke "parent" methods without the...

Description Usage Arguments Value Examples

View source: R/super.R

Description

Giving R the ability to invoke "parent" methods without the use of S3 generics.

Call the next available function by the same name.

Usage

1

Arguments

...

The arguments passed to the parent function.

Value

the result of calling the next available function.

Examples

 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
function1 <- function() {
  print("Top-level")
  invisible(NULL)
}

local({
  function2 <- function() {
    function1 <- function() {
      print("Mid-level")
      super::super()
    }

    function3 <- function() {
      function1 <- function() {
        print("Low-level")
        super::super()
      }
      function1()
    }

    function3()
  }

  function2()
})
# Will print
# [1] "Low-level"
# [1] "Mid-level"
# [1] "Top-level"

robertzk/super documentation built on May 27, 2019, 11:37 a.m.