File: displayCode.Rd

package info (click to toggle)
r-cran-r.utils 2.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,864 kB
  • sloc: sh: 18; makefile: 6
file content (67 lines) | stat: -rw-r--r-- 2,341 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Do not modify this file since it was automatically generated from:
% 
%  displayCode.R
% 
% by the Rdoc compiler part of the R.oo package.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\name{displayCode}
\alias{displayCode.default}
\alias{displayCode}

\title{Displays the contents of a text file with line numbers and more}

\description{
 Displays the contents of a text file with line numbers and more.
}

\usage{
\method{displayCode}{default}(con=NULL, code=NULL, numerate=TRUE, lines=-1, wrap=79, highlight=NULL,
  pager=getOption("pager"), ...)
}

\arguments{
  \item{con}{A \code{\link[base:connections]{connection}} or a \code{\link[base]{character}} string filename.
    If \code{code} is specified, this argument is ignored.}
  \item{code}{A \code{\link[base]{character}} \code{\link[base]{vector}} of code lines to be displayed.}
  \item{numerate}{If \code{\link[base:logical]{TRUE}}, line are numbers, otherwise not.}
  \item{lines}{If a single \code{\link[base]{numeric}}, the maximum number of lines to show.
    If -1, all lines are shown. If a \code{\link[base]{vector}} of \code{\link[base]{numeric}}, the lines
    numbers to display.}
  \item{wrap}{The (output) column \code{\link[base]{numeric}} where to wrap lines.}
  \item{highlight}{A \code{\link[base]{vector}} of line number to be highlighted.}
  \item{pager}{If \code{"none"}, code is not displayed in a pager, but
    only returned. For other options, see \code{\link[base]{file.show}}().}
  \item{...}{Additional arguments passed to \code{\link[base]{file.show}}(),
    which is used to display the formatted code.}
}

\value{
  Returns (invisibly) the formatted code as a \code{\link[base]{character}} string.
}

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

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

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

\author{Henrik Bengtsson}

\seealso{
 \code{\link[base]{file.show}}().
}



\keyword{file}
\keyword{IO}