identifyfuns: identifyfuns uses text from readLines to identify function...

View source: R/rutils.R

identifyfunsR Documentation

identifyfuns uses text from readLines to identify function beginnings

Description

identifyfuns is used when tracing the interactions between functions within R packages. It uses the vector of character vectors that is produced by readLines and identifies the starting lines of all functions. It ignores all functions defined within comments, as well as ignoring all functions defined internally to other functions. It does the latter by testing for a couple of spaces at the start of a line containing a function definition, which functions defined within another function should have.

Usage

identifyfuns(content)

Arguments

content

the output of applying readLines to a text file containing R code.

Value

a vector of line numbers identifying the start of all functions within the content. This may be a vector of zero length if there are no functions.

See Also

describefunctions, findfuns

Examples

txt <- c("# this is a comment",
"dummy <- function() { return(NULL) }",
"# a possibly confusing use of function",
"anotherdummy <- function() { return(NULL) }")
identifyfuns(txt)

haddonm/codeutils documentation built on April 15, 2024, 1:02 p.m.