Skip to content

Instantly share code, notes, and snippets.

@DavZim
Last active January 11, 2018 11:59
Show Gist options
  • Save DavZim/1f9764eb505a1d3536688b2558add9e5 to your computer and use it in GitHub Desktop.
Save DavZim/1f9764eb505a1d3536688b2558add9e5 to your computer and use it in GitHub Desktop.
power <- function(x, power) {
  return(x^power)
}

foo <- function(x, ...) {
  cat("You just called 'foo'\n")
  power(x, ...)
}

foo(2, 3)
#> You just called 'foo'
#> [1] 8

foo(2, power = 4)
#> You just called 'foo'
#> [1] 16

foo(2, bar = 123)
#> You just called 'foo'
#> Error in power(x, ...): unused argument (bar = 123)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment