List exported objects from R package without attaching it
Asked Answered
C

2

14

Is there a way to list the objects that a package exports, without actually attaching it? I tried

ls(loadNamespace("ggplot2"))

However this shows all of the defined and imported objects in this package. Instead I would like to see only the exported names. I.e. I would like the result of

library(ggplot2)
ls("package:ggplot2")

But without actually attaching the package to my search path.

Calvaria answered 11/3, 2012 at 20:17 Comment(0)
W
26

You could use documented getNamespaceExports("ggplot2").

Waterline answered 12/3, 2012 at 22:37 Comment(0)
C
6

Ah found it. The undocumented

ls(getNamespaceInfo(mynamespace, "exports"));

Seems to do the trick.

Calvaria answered 11/3, 2012 at 20:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.