Suppose I have a function closure in my package, for example

f = function(x) {
    x = x
    g = function(y) x <<- y
    h = function() x
    list(g = g, h = h)
}

l = f(5)
l$g(10)
l$h()

What is the correct (in the official CRAN sense) way of documenting this function? In particular,

  1. I would like to use roxygen2
  2. I would like to provide documentation for the functions g and h
Edit
Report