findRscript: Find R scripts by content with pattern matching

Description Usage Arguments Examples

View source: R/findRscript.R

Description

findRscript scans all directories and subdirectories of a given path for R scripts (.R) containing a specific pattern. Hits can be copied to a new folder.

Usage

1
2
3
findRscript(pattern = "Hello World", path = ".", case.sensitive = TRUE,
  comments = TRUE, show.results = TRUE, copy = FALSE,
  folder = "findRscript", overwrite = TRUE)

Arguments

pattern

a pattern (regular expression) to search for.

path

a character vector, path to be scanned. The default corresponds to the working directory, getwd().

case.sensitive

a logical value. If TRUE, pattern-matching is case-sensitive.

comments

a logical value. If TRUE, comments (lines starting with #) are included in the pattern-matching procedure.

show.results

a logical value. If TRUE, results are printed after completion.

copy

a logical value. If TRUE, all matching R scripts are copied to folder.

folder

a character vector, path or name of new folder to copy matching R scripts to.

overwrite

a logical value. If TRUE, existing destination files are overwritten.

Examples

1
2
3
4
5
6
# Find all Rscripts in the package folder that use the circlize package
findRscript(path = system.file(package = "findR"), pattern = "circlize")

# Save results in a data frame and show hits
dt <- findRscript(path = system.file(package = "findR"), pattern = "circlize", show.results = TRUE)
dt

zumbov2/findR documentation built on Dec. 30, 2019, 6:40 p.m.