Searches through the list of supplied for matching strings of text. Useful in finding files that you know contain certain text snippets.
search_raw(files, text, search_title = TRUE, search_contents = TRUE)
Vector string of files (either names or paths).
String (can be regex) to search for.
Logical (default=TRUE
). Should matching occur in title.
Logical (default=TRUE
). Should matching occur in
file contents.
A subset of files
with contents matching text
.
ls_scripts("Scripts") %>% search_raw("AUC") ## finds all scripts containing string "AUC"
#> NULL
## regex match find instances of AUC() function being used
ls_scripts("Scripts") %>% search_raw("AUC\\(")
#> NULL
## requires NMproject directory structure to operate in
if (FALSE) {
## bring file(s) into project
ls_scripts("/path/to/other/analysis/scripts/dir") %>%
search_raw("AUC\\(") %>%
import()
}