Skip to content
Prev 7468 / 12125 Next

[R-pkg-devel] Concise Summary For Any Variety Of R Function

Dario,

there is not such thing as S4 function. However, all functions have an environment and for functions from packages that environment will be the namespace of the package. So in those special cases you can use environmentName() to get the name, e.g.:
ls from base
rnorm from stats
who from R_GlobalEnv 

However, this won't work for functions defined in arbitrary environments which have no name:
+ who(f)
+ })
f from  

Depending on how much time you want to spend, you can do a search up the frames to find a named environment, but the concept you're trying to implement looks very fragile.

Cheers,
Simon