inside: Search a string within files of a folder

View source: R/inside.R

insideR Documentation

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(
  text = stop("A text to be searched for is necessary"),
  path = ".",
  pattern = "*\\.R$",
  showallfilenames = FALSE,
  ...,
  fixed = TRUE,
  ignore.case = FALSE
)

Arguments

text

Text to search in files

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.

Details

inside Search a string within files of a folder

Value

Return an invisible vector with filenames in which the pattern occurs

Author(s)

Marc Girondot marc.girondot@gmail.com

Examples

## Not run: 
library(HelpersMG)
# Search for files in path with names based on pattern that have the string search inside.
inside("embryogrowth", path=".", pattern="*\\.R$")

## End(Not run)

HelpersMG documentation built on Oct. 5, 2023, 5:08 p.m.