string_in_dir: Find string occurrences in files within a directory

Description Usage Arguments Value See Also

View source: R/string_in_dir.R

Description

Finds the location, frequency, and context with which a given string is used in files contained within a specified directory. Regular expressions are supported to facilitate searching in both string location and file selection.

Usage

1
string_in_dir(path = NULL, string, print_negs = F, print_lines = F, ...)

Arguments

path

a character string (length == 1) pointing to the location of the directory to search. Passed to dir(path). Defaults to NULL, which specifies the working directory

string

a character string (length == 1) indicating the string to search for Regular expressions are supported here

print_negs

logical. Do you wish to see the names of the files were searched but that do not have any matches? Defaults to FALSE

print_lines

logical or "ask". Do you wish to see the specific line matches in each file? Specifying "ask" will ask the user before printing. Defaults to FALSE

...

optional arguments to be passed to dir() when selecting files to search. For example, recursive = TRUE will search files within subdirectories, and pattern = ".R|.Rmd" will search only within files with these extensions.

Value

The search results are printed to the console.

See Also

dir


bstaton1/StatonMisc documentation built on May 18, 2020, 12:06 a.m.