Learn R Programming

HelpersMG (version 5.1)

inside.search: Search a string within files of a folder

Description

Search for a string inside the files of a folder and return where the string is found. The pattern for files that must be included uses regex for filtering.

Usage

inside.search(
  path = ".",
  pattern = "*\\.R$",
  showallfilenames = FALSE,
  ...,
  fixed = TRUE,
  ignore.case = FALSE,
  text = stop("A text to be searched for is necessary")
)

Arguments

path

Path of the folder to search in

pattern

Pattern for file names to search in

showallfilenames

logical. Show all the filenames search for in

...

Options for readLines(), example warn = FALSE

fixed

logical. If TRUE, pattern is a string to be matched as is. Overrides all conflicting arguments (see gsub)

ignore.case

logical. if FALSE, the pattern matching for text is case sensitive and if TRUE, case is ignored during matching.

text

Text to search in files

Value

Return an invisible vector with filenames in which the pattern occurs

Details

inside.search Search a string within files of a folder

Examples

Run this code
# NOT RUN {
library(HelpersMG)
# Search for files in path with names based on pattern that have the string search inside.
inside.search(path=".", pattern="*\\.R$", search="embryogrowth")
# }

Run the code above in your browser using DataLab