Created
August 29, 2023 06:00
-
-
Save brshallo/246b02d652d35995b73c42ee88079c87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(magrittr) | |
find_in_files <- function(path, pattern){ | |
path %>% | |
fs::dir_ls(recurse = TRUE, type = "file", regexp = "(\\.[rR])$") %>% | |
purrr::map(~grep(pattern, readLines(.x, warn = FALSE), value = TRUE)) %>% | |
purrr::keep(~length(.x) > 0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment