import.function.header: Search for & import the function header from within a source...

Description Usage Arguments Value Author(s)

Description

I usually write detailed comment headers before functions in source code files. scenarios: 1. function header preceded by comment block preceded by (blank line, or top of file) 2. function header preceded by (blank line or top of file) -> no comment has been written.

Usage

1
2
3
4
  import.function.header(func,
    src.root = getOption("src.root"), src.files = NULL,
    strip.comment.char = FALSE,
    exclude.patterns = c("~", ".Rcheck", ".git", ".svn"))

Arguments

func

a function name, or the function's code

src.root

The parent folder of source code

src.files

an optional vector of filenames to search within

strip.comment.char

logical: if TRUE, strip the leading comment characters.

exclude.patterns

vector of patterns passed to grep for files to exclude

Value

This code extracts the src code, and the header, or returns ""

Author(s)

Mark Cowley, 2009-10-13


drmjc/updateR documentation built on May 15, 2019, 2:41 p.m.