find_pattern: Find a pattern in files from a directory

Description Usage Arguments Value Examples

View source: R/find_pattern.R

Description

find_pattern search a pattern in all files from a directory and is_on_file search for a pattern in one file.

Usage

1
2
3
find_pattern(pattern, where = here(), full_names = FALSE)

is_in_file(pattern, file)

Arguments

pattern

the pattern to find. Can be regex

where

the path to the directory where you want to search

full_names

a logical value as in list.files. If TRUE, the directory path is prepended to the file names to give a relative file path. If FALSE, the file names (rather than paths) are returned.

file

the path to the file where you want to search

Value

a vector with all the files where the pattern was found for find_pattern or a logical value for is_on_file

Examples

1
2
3
4
5
6
7
find_pattern(pattern = "usethis::", where = system.file(package = "benutils"))

## Not run: 
# if you are in a R project you can just specify the pattern
find_pattern("my_pattern")

## End(Not run)

BenjaminLouis/benutils documentation built on Jan. 25, 2021, 6:12 a.m.