rtags                 package:utils                 R Documentation

_A_n _e_t_a_g_s-_l_i_k_e _a _t_a_g_g_i_n_g _u_t_i_l_i_t_y _f_o_r _R

_D_e_s_c_r_i_p_t_i_o_n:

     'rtags' provides etags-like indexing capabilities for R code,
     using R's own parser.

_U_s_a_g_e:

     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"))

_A_r_g_u_m_e_n_t_s:

path, pattern, recursive: Arguments passed on to '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: A vector of file names to be indexed. 

 keep.re: A regular expression further restricting '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'. 

   ofile: Passed on to '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). 

  append: Logical, indicating whether the output should overwrite an
          existing file, or append to it. 

 verbose: Logical.  If 'TRUE', file names are echoed to the R console
          as they are processed. 

_D_e_t_a_i_l_s:

     Many text editors allow definitions of functions and other
     language objects to be quickly and easily located in source files
     through a tagging utility.  This functionality requires the
     relevant source files to be preprocessed, producing an index (or
     tag) file containing the names and their corresponding locations. 
     There are multiple tag file formats, the most popular being the
     vi-style ctags format and the and emacs-style etags format.  Tag
     files in these formats are usually generated by the '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.

_A_u_t_h_o_r(_s):

     Deepayan Sarkar

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://en.wikipedia.org/wiki/Ctags>, <URL:
     http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/emacs.html#Tags>

_S_e_e _A_l_s_o:

     'list.files', 'cat'

_E_x_a_m_p_l_e_s:

     ## Not run: 
     rtags("/path/to/src/repository",
           pattern = "[.]*\\.[RrSs]$",
           keep.re = "/R/",
           verbose = TRUE,
           ofile = "TAGS",
           append = FALSE,
           recursive = TRUE)
     ## End(Not run)

