Create a function within a function [closed]

Here is an example of function inside a function

f <- function(n) {
  g <- function(x) {
    x**n
  }
}

such that

> f(3)(4)
[1] 64

But I have no idea what you are exactly after…

Leave a Comment