rtags
provides etags-like indexing capabilities for R code,
using R's own parser.rtags(path = ".", pattern = "\\.[RrSs]$",
recursive = FALSE,
src = list.files(path = path, pattern = pattern,
full.names = TRUE,
recursive = recursive),
keep.re = NULL,
ofile = "", append = FALSE,
verbose = getOption("verbose"))
list.files
to determine the
files to be tagged. By default, these are all files with extension
.R
, .r
, .S
, and .s
in the current
directory. These arguments are ignored if src
is specified.src
(the files to be indexed). For example, specifying
keep.re = "/R/[^/]*\\.R$"
will only retain files with
extension .R
inside a directory named R
.cat
as the file
argument; typically the output file where the tags will be written
("TAGS"
by convention). By default, the output is written to
the R console (unless redirected).TRUE
, file names are echoed to the
R console as they are processed.ctags
and etags
utilities respectively.
Unfortunately, these programs do not recognize R code syntax. They do
allow tagging of arbitrary language files through regular expressions,
but this too is insufficient. The rtags
function is intended to be a tagging utility for R
code. It parses R code files (using R's parser) and produces tags in
Emacs' etags format. Support for vi-style tags is currently absent,
but should not be difficult to add.
list.files
, cat
rtags("/path/to/src/repository",
pattern = "[.]*\\.[RrSs]$",
keep.re = "/R/",
verbose = TRUE,
ofile = "TAGS",
append = FALSE,
recursive = TRUE)
Run the code above in your browser using DataLab