GSee GSee - 3 months ago 17
R Question

Show names of everything in a package

Is there an easy way to list everything in a package from within R?

For example, if I type

foreach:::
and hit tab twice, I can see everything that's there.

How else can I get those names of objects?

Note,
ls("package:foreach", all.names=TRUE)
does not show things like
.foreachGlobals

Answer

ls("package:foreach", all.names=TRUE) only shows what's attached to the search path, which only includes the objects exported from the namespace. Use ls on the results of getNamespace instead:

ls(getNamespace("foreach"), all.names=TRUE)