How do you determine the namespace of a function?
I very recently learned about find()
which seems to do just this.
R> find("ls")
[1] "package:base"
R> find("na.locf")
[1] "package:zoo"
You want getNamespaceName
+ environment
:
getNamespaceName(environment(mean.default))
# [1] "base"