File: format_funusage.Rd

package info (click to toggle)
r-cran-rdpack 2.6.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,156 kB
  • sloc: sh: 13; makefile: 4
file content (72 lines) | stat: -rw-r--r-- 2,682 bytes parent folder | download | duplicates (4)
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
68
69
70
71
72
\name{format_funusage}
\alias{format_funusage}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Format the usage text of functions}
\description{Formats the usage text of a function so that each line
  contains no more than a given number of characters.}
\usage{
format_funusage(x, name = "", width = 72, realname)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{x}{a character vector containing one element for each argument
    of the function, see `Details'.}
  \item{name}{the name of the function whose usage is described, a
    string.}
  \item{width}{maximal width of each line of output.}
  \item{realname}{the printed form of \code{name}, see `Details', a
    string.}
}
\details{
  \code{format_funusage} formats the usage text of a function for
  inclusion in Rd documentation files.  If necessary, it splits the text
  into more lines in order to fit it within the requested width.

  Each element of argument \code{x} contains the text for one argument
  of function \code{name} in the form \code{arg} or \code{arg = default}.
  \code{format_funusage} does not look into the content of
  \code{x}, it does the necessary pasting to form the complete usage
  text, inserting new lines and indentation to stay within the specified
  width.  Elements of \code{x} are never split. If an argument (i.e.,
  element of \code{x}) would cause the width to be exceeded, the entire
  argument is moved to the following line.

  The text on the second and subsequent lines of each usage item starts
  in the column just after the opening parenthesis which follows the
  name of the function on the first line.

  In descriptions of S3 methods and S4 methods, argument \code{name} may
  be a TeX macro like \verb{\method{print}{ts}}. In that case the number
  of characters in \code{name} has little bearing on the actual number
  printed. In this case argument \code{realname} is used for counting
  both the number of characters on the first line of the usage message
  and the indentation for the subsequent lines.

}

\value{
  The formatted text as a length one character vector.
}


\author{Georgi N. Boshnakov}
\note{
  Only the width of \code{realname} is used (for counting). The
  formatted text contains \code{name}.

  The width of strings is determined by calling \code{nchar} with
  argument \code{type} set to "width".
}

%% ~Make other sections like Warning with \section{Warning }{....} ~

\seealso{
  \code{\link{deparse_usage1}}
}
\examples{
# this function is essentially internal,
# see deparse_usage1 and as.character.f_usage which use it.
}
%\keyword{RdoProgramming}
\keyword{RdoUsage}
%\keyword{RdFunction}