import.function: Search for & import the function definition from within a...

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 a 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
  import.function(func, src.root = getOption("src.root"),
    src.files = NULL, import.header = TRUE,
    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

import.header

search for & import the header comments. TRUE/FALSE

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, 2011-04-07


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