formatDL                package:base                R Documentation

_F_o_r_m_a_t _D_e_s_c_r_i_p_t_i_o_n _L_i_s_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Format vectors of items and their descriptions as 2-column tables
     or LaTeX-style description lists.

_U_s_a_g_e:

     formatDL(x, y, style = c("table", "list"),
              width = 0.9 * getOption("width"), indent = NULL)

_A_r_g_u_m_e_n_t_s:

       x: a vector giving the items to be described, or a list of
          length 2 or a matrix with 2 columns giving both items and
          descriptions.

       y: a vector of the same length as `x' with the corresponding
          descriptions.  Only used if `x' does not already give the
          descriptions.

   style: a character string specifying the rendering style of the
          description information.  If `"table"', a two-column table
          with items and descriptions as columns is produced (similar
          to Texinfo's `@table' environment.  If `"list"', a
          LaTeX-style tagged description list is obtained.

   width: a positive integer giving the target column for wrapping
          lines in the output.

  indent: a positive integer specifying the indentation of the second
          column in table style, and the indentation of continuation
          lines in list style.  Must not be greater than `width/2', and
          defaults to `width/3' for table style and `width/9' for list
          style.

_D_e_t_a_i_l_s:

     After extracting the vectors of items and corresponding
     descriptions from the arguments, both are coerced to character
     vectors.

     In table style, items with more than `indent - 3' characters are
     displayed on a line of their own.

_V_a_l_u_e:

     a character vector with the formatted entries.

_E_x_a_m_p_l_e_s:

     ## Use R to create the `INDEX' for package `eda' from its `CONTENTS'
     x <- read.dcf(file = system.file("CONTENTS", package = "eda"),
                    fields = c("Entry", "Description"))
     x <- as.data.frame(x)
     writeLines(formatDL(x$Entry, x$Description))
     ## or equivalently: writeLines(formatDL(x))
     ## Same information in tagged description list style:
     writeLines(formatDL(x$Entry, x$Description, style = "list"))
     ## or equivalently: writeLines(formatDL(x, style = "list"))

