displayCode             package:R.utils             R Documentation

_D_i_s_p_l_a_y_s _t_h_e _c_o_n_t_e_n_t_s _o_f _a _t_e_x_t _f_i_l_e _w_i_t_h _l_i_n_e _n_u_m_b_e_r_s _a_n_d _m_o_r_e

_D_e_s_c_r_i_p_t_i_o_n:

     Displays the contents of a text file with line numbers and more.

_U_s_a_g_e:

     ## Default S3 method:
     displayCode(con=NULL, code=NULL, numerate=TRUE, lines=-1, wrap=79, highlight=NULL, pager=getOption("pager"), ...)

_A_r_g_u_m_e_n_t_s:

     con: A 'connection' or a 'character' string filename. If 'code' is
          specified, this argument is ignored.

    code: A 'character' 'vector' of code lines to be displayed.

numerate: If 'TRUE', line are numbers, otherwise not.

   lines: If a single 'numeric', the maximum number of lines to show.
          If -1, all lines are shown. If a 'vector' of 'numeric', the
          lines numbers to display.

    wrap: The (output) column 'numeric' where to wrap lines.

highlight: A 'vector' of line number to be highlighted.

   pager: If '"none"', code is not displayed in a pager, but only
          returned. For other options, see 'file.show'().

     ...: Additional arguments passed to 'file.show'(), which is used
          to display the formatted code.

_V_a_l_u_e:

     Returns (invisibly) the formatted code as a 'character' string.

_A_u_t_h_o_r(_s):

     Henrik Bengtsson (<URL: http://www.braju.com/R/>)

_S_e_e _A_l_s_o:

     'file.show'().

_E_x_a_m_p_l_e_s:

     file <- system.file("DESCRIPTION", package="R.utils")
     cat("Displaying: ", file, ":\n", sep="")
     displayCode(file)

     file <- system.file("CONTENTS", package="R.utils")
     cat("Displaying: ", file, ":\n", sep="")
     displayCode(file, numerate=FALSE, lines=100:110, wrap=65)

     file <- system.file("CONTENTS", package="R.utils")
     cat("Displaying: ", file, ":\n", sep="")
     displayCode(file, lines=100:110, wrap=65, highlight=c(101,104:108))

