Skip to content

Commit

Permalink
Update file_search.R
Browse files Browse the repository at this point in the history
  • Loading branch information
jjesusfilho authored Feb 2, 2024
1 parent 3b79c38 commit 164a2da
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions R/file_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ file_search <- function( pattern = "", dir = "R"){

a <- list.files(dir,full.names = TRUE)

purrr::map_chr(a,~readLines(.x) %>% stringr::str_c(collapse ="\n")) %>%
stringr::str_which(pattern) %>%
a[.]
purrr::map_chr(a, ~{
readr::read_lines(.x) %>%
stringr::str_c(collapse = "\n")
}) |>
stringr::str_which(pattern) |>
vctrs::vec_slice(a, i= _)

}
}

0 comments on commit 164a2da

Please sign in to comment.