I maintain an R package that partially depends on sp. sp is now retiring, and I need to find all occurrences in the code that use it - to replace with functions from sf.
Finding those where I used sp:: is easy, but I might have forgotten it somewhere, because roxygen2 still tries to load sp when preparing the documentation.
Is there a way of finding all occurrences of functions from a certain package in a file or package?
I appreciate your help!
I have manually printed the list of functions from sp but I do not plan to grep them all manually. There must be an easier way ...
R CMD check, as proposed by @Carl Witthoft in his comment, surely is the easiest way.
Otherwise, especially if you use RStudio, you can use the findInFiles package. First get all functions of sp:
Then construct a regular expression which matches these function names:
Then, from the R directory, use findInFiles as follows:
If you use RStudio, this will display all matches in the viewer pane, with pretty colors.