File: p.Rd

package info (click to toggle)
r-cran-pander 0.6.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,804 kB
  • sloc: javascript: 301; cpp: 145; lisp: 94; makefile: 21
file content (53 lines) | stat: -rw-r--r-- 2,538 bytes parent folder | download
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helpers.R
\name{p}
\alias{p}
\title{Inline Printing}
\usage{
p(x, wrap = panderOptions("p.wrap"), sep = panderOptions("p.sep"),
  copula = panderOptions("p.copula"), limit = Inf,
  keep.trailing.zeros = panderOptions("keep.trailing.zeros"),
  missing = panderOptions("missing"), digits = panderOptions("digits"),
  round = panderOptions("round"))
}
\arguments{
\item{x}{an atomic vector to get merged for inline printing}

\item{wrap}{a string to wrap vector elements (uses value set in \code{p.wrap} option: \code{'_'} by default, which is a markdown-friendly wrapper and it puts the string in \emph{italic})}

\item{sep}{a string with the main separator, i.e. the one that separates all vector elements but the last two (uses the value set in \code{p.sep} option - \code{','} by default)}

\item{copula}{a string with ending separator - the one that separates the last two vector elements (uses the value set in \code{p.copula} option, \code{'and'} by default)}

\item{limit}{maximum character length (defaults to \code{Inf}initive  elements)}

\item{keep.trailing.zeros}{to show or remove trailing zeros in numbers}

\item{missing}{string to replace missing values}

\item{digits}{numeric (default: 2) passed to format}

\item{round}{numeric (default: Inf) passed to round}
}
\value{
a string with concatenated vector contents
}
\description{
\code{\link{p}} merges elements of a vector in one string for the sake of pretty inline printing. Default parameters are read from appropriate \code{option} values (see argument description for details). This function allows you to put the results of an expression that yields a variable \emph{inline}, by wrapping the vector elements with the string provided in \code{wrap}, and separating elements by main and ending separator (\code{sep} and \code{copula}). In case of a two-length vector, value specified in \code{copula} will be used as a separator. You can also control the length of provided vector by altering an integer value specified in \code{limit} argument (defaults to \code{Inf}).
}
\examples{
p(c('fee', 'fi', 'foo', 'fam'))
# [1] '_fee_, _fi_, _foo_ and _fam_'
p(1:3, wrap = '')
# [1] '1, 2 and 3'
p(LETTERS[1:5], copula = 'and the letter')
# [1] '_A_, _B_, _C_, _D_ and the letter _E_'
p(c('Thelma', 'Louise'), wrap = '', copula = '&')
# [1] 'Thelma & Louise'
}
\references{
This function was moved from \code{rapport} package: \url{http://rapport-package.info}.
}
\author{
Aleksandar Blagotic
}