get_files: Finding Pattern in R Files

View source: R/get_files.R

get_filesR Documentation

Finding Pattern in R Files

Description

get_files searches for matches to argument pattern within each R file that is a descendant of parent directory dir. It works like a global find function that returns all R files within dir that match pattern. Be careful not to choose a parent directory has too many subdirectories and files.

Usage

get_files(dir, pattern = "", suffix = ".R$")

Arguments

dir

A character string that defines the root directory within which all R files will be analysed

pattern

A character string containing a regular expression to be matched in all R files found in the specified directory

suffix

A string with a pattern to filter the searched file endings. The default is ".R$" to only look for R-files. Use "." to search all files.

Value

Returns a character vector containing all files that match the pattern

Author(s)

Tobias Krabel

Examples

## Not run: 
# Find all files in . that load packages through library
get_files(dir = ".", pattern = "library")

## End(Not run)

STATWORX/helfRlein documentation built on Feb. 12, 2024, 2:21 a.m.