Prevent RStudio Find in Files from searching renv library?

The RStudio Find in Files command recursively searches the entire project directory. When using the {renv} package manager in an RStudio project, the project library is in the project directory, so there may be quite a few files to search. This can slow the search considerably and return spurious results from library files.

Is there any way to prevent RStudio from searching the renv library directory?

Thanks!
Kent

Hi,

It seems you can only use regex to specify the search term, but not the folder. One option you could consider is using the terminal window in RStudio and using grep.

grep -iRl "data.frame" --exclude-dir=.Rproj.user

In this case, all files containing the term data.frame will be returned, apart from those in the folder ./.Rproj.user/ (a hidden folder).

It's not perfect, but it might help speed up things.

PJ

In the RStudio v1.3 preview release, the renv library directory should be properly ignored. Can you confirm if that's the case for you as well?

That sounds perfect, I'll check it out, thanks!

Trying RStudio Version 1.3.926 on Windows 10, it's not clear what it is doing. It doesn't find items in the renv directory, but the grep task takes a very long time to complete. If I run Find in Files in a non-renv project, the task completes normally.

Are you using Git in your project? If so, I'd highly recommend turning on Standard Git exclusions for the Find in Files operation:

This should substantially speed up the grep operation.

This particular project does not have any source control.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.