displayCode.Rd
Displays the contents of a text file with line numbers and more.
# S3 method for default
displayCode(con=NULL, code=NULL, numerate=TRUE, lines=-1, wrap=79, highlight=NULL,
pager=getOption("pager"), ...)
A connection
or a character
string filename.
If code
is specified, this argument is ignored.
If TRUE
, line are numbers, otherwise not.
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.
The (output) column numeric
where to wrap lines.
A vector
of line number to be highlighted.
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.show
().
file <- system.file("DESCRIPTION", package="R.utils")
cat("Displaying: ", file, ":\n", sep="")
#> Displaying: /tmp/henrik/RtmpsaLUi7/temp_libpath230bf3b96e771/R.utils/DESCRIPTION:
displayCode(file)
file <- system.file("NEWS.md", package="R.utils")
cat("Displaying: ", file, ":\n", sep="")
#> Displaying: /tmp/henrik/RtmpsaLUi7/temp_libpath230bf3b96e771/R.utils/NEWS.md:
displayCode(file, numerate=FALSE, lines=100:110, wrap=65)
file <- system.file("NEWS.md", package="R.utils")
cat("Displaying: ", file, ":\n", sep="")
#> Displaying: /tmp/henrik/RtmpsaLUi7/temp_libpath230bf3b96e771/R.utils/NEWS.md:
displayCode(file, lines=100:110, wrap=65, highlight=c(101,104:108))