2

Suppose I wish to find instances of the use of one or more functions in the code of base or submitted packages, for purpose of better understanding idiomatic use of those functions. That is to say, I want to do a code search for the places where a function is used, not a search for places where that function is defined. So I would want to include e.g., unexported functions.

Ideally I would like to do RegEx matching so as to find functions with similar names that might serve a parallel function. I would also like to be able to restrict the output based on R's logical tests of output type, to find, e.g., only functions, or some finer subdivisions, such as is.primitive() or is.closure(), or (from rlang) is_primitive_eager() or is_primitive_lazy().

I note that some of the kinds of search I am asking about exist for package documentation in the sos package. Also, I know that grep searches can be done on the names of exported functions of loaded packages, as here: Searching functions using grep over multiple loaded packages in R, and Jim Hester's lookup package finds function definitions in CRAN packages even if they are not installed. See also Ben Bolker's answer, here: Name of a package for a given function in R But none of these methods will search for function usage as opposed to function definition.

andrewH
  • 2,281
  • 2
  • 22
  • 32

0 Answers0