edit.src.file: edit an R source file

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Search for the .R file that contains a function, and open it in an editor. It searches for the file containing the function definition, by grepping for the pattern "^my.func.name <- function", where my.func.name is the name of func.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  edit.src.file(func, src.root = getOption("src.root"),
    src.files = NULL, editor = getOption("editor"),
    exclude.patterns = c("~", ".Rcheck", ".git", ".svn"))

  kate(func, src.root = getOption("src.root"))

  textmate(func, src.root = getOption("src.root"))

  tm(func, src.root = getOption("src.root"))

  mate(func, src.root = getOption("src.root"))

  smultron(func, src.root = getOption("src.root"))

Arguments

func

the quoted 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

editor

the path to your editor. Default = getOption("editor")

exclude.patterns

vector of patterns passed to grep for files to exclude.

Details

There are functions which work with textmate on OSX (textmate, tm, mate; smultron), or on Linux (kate = KDE Advanced Text Editor).

Common usage scenarios are that you have a folder full of R packages under development. In this case, set src.root, or better yet, the options(src.root="/path/to/source/root") to point to the top level folder containing all the R packages. If you also have a number of .R source files, then you can provide these files via the src.files argument.

Value

nothing. The side effect is that an R source file is opened in an editor.

Author(s)

Mark Cowley, 26/2/07

See Also

find.src.file

Examples

1
2
3
4
5
## Not run: 
edit.src.file("edit.src.file", "~/src/R")
edit.src.file("edit.src.file", "~/src/R", editor="open -a TextMate")

## End(Not run)

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