search_raw: Search for files matching raw text search

View source: R/import-code.R

search_rawR Documentation

Search for files matching raw text search

Description

[Stable]

Searches through the list of supplied for matching strings of text. Useful in finding files that you know contain certain text snippets.

Usage

search_raw(files, text, search_title = TRUE, search_contents = TRUE)

Arguments

files

Vector string of files (either names or paths).

text

String (can be regex) to search for.

search_title

Logical (default=TRUE). Should matching occur in title.

search_contents

Logical (default=TRUE). Should matching occur in file contents.

Value

A subset of files with contents matching text.

See Also

ls_scripts(), ls_code_library(), stage()

Examples



ls_scripts("Scripts") %>% search_raw("AUC") ## finds all scripts containing string "AUC"

## regex match find instances of AUC() function being used
ls_scripts("Scripts") %>% search_raw("AUC\\(")

## requires NMproject directory structure to operate in
## Not run: 
## bring file(s) into project
ls_scripts("/path/to/other/analysis/scripts/dir") %>%
  search_raw("AUC\\(") %>%
  import()

## End(Not run)


NMproject documentation built on Sept. 30, 2022, 1:06 a.m.