findScriptsByParsing: Find Scripts that contain an object or package-dependency by...

Description Usage Arguments Details Value

View source: R/findScripts.R

Description

Find scripts that have an object or function that you know the name or package of

Usage

1
2
findScriptsByParsing(path = ".", filename_pattern = ".R$",
  recursive = FALSE, pkg = NULL, code_target, func_pattern = "")

Arguments

path

a character vector of full path names; the default corresponds to the working directory, getwd. Tilde expansion (see path.expand) is performed. Missing values will be ignored.

filename_pattern

a regular expression- default is '.R$'. Only file names which match the regular expression will be returned.

recursive

logical. Should the listing recurse into directories?

pkg

The name of a currently loaded package passed as a string.

code_target

character string containing a regular expression to be matched against code while parsing through scripts. If a character vector of length 2 or more is supplied, the first element is used with a warning. If looking for a pattern, try findScriptsByPattern.

func_pattern

character string containing a regular expression to be matched against the functions found in the package chosen in the argument pkg. If a character vector of length 2 or more is supplied, the first element is used with a warning.

Details

Parses scripts and finds which scripts have a sought object, such as the string 'password123' or a functional dependency on a package, e.g. RJDBC.
This function actually reads through scripts and will discard scripts that do not run due to typos and bad syntax.
This function will NOT find a pattern such as 'x <- 3^2'- for that task, use findScriptsByPattern.
NOTE: This function cannot distinguish between functions from different packages that have the similar names.

Value

A data.frame with five columns:
script - The name of the script containing the target,
linenum - The line number on which the target is found,
col - the number of characters into the line that the target can be found,
text - the target matched,
line - the target within its context


ivanliu1989/RQuant documentation built on Sept. 13, 2019, 11:53 a.m.