kjo kjo - 1 year ago 68
R Question

How to determine the package that defines a particular identifier?

When reading source code written by others, it is often difficult for me to figure out what package a particular identifier (typically a function) comes from. (This is because such code "imports" identifiers through statements of the form

, which enables the use in the code of the imported identifiers without having to provide a package qualifier.)

Is there a simple way to determine the package a particular identifier comes from?

Answer Source

You can use the function getAnywhere(). Try this:


This tells you both the package and the namespace:

[1] "package:dplyr"      "namespace:magrittr"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download