kjo kjo - 2 months ago 4x
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?


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


This tells you both the package and the namespace:

[1] "package:dplyr"      "namespace:magrittr"