displayCode

0th

Percentile

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

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

Usage
## S3 method for class 'default}(con=NULL, code=NULL, numerate=TRUE, lines=-1, wrap=79, highlight=NULL, pager=getOption("pager"), ...)':
displayCodeundefined

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.}

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

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

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

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

[object Object]

file.show().



file
IO
Aliases
  • displayCode.default
  • displayCode
Documentation reproduced from package R.utils, version 0.7.9, License: LGPL version 2.1 or newer (the releases)

Community examples

Looks like there are no examples yet.