Inline Printing
p
merges elements of a vector in one string for the sake of pretty inline printing. Default parameters are read from appropriate option
values (see argument description for details). This function allows you to put the results of an expression that yields a variable inline, by wrapping the vector elements with the string provided in wrap
, and separating elements by main and ending separator (sep
and copula
). In case of a two-length vector, value specified in copula
will be used as a separator. You can also control the length of provided vector by altering an integer value specified in limit
argument (defaults to Inf
).
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"))
x |
an atomic vector to get merged for inline printing |
wrap |
a string to wrap vector elements (uses value set in |
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 |
copula |
a string with ending separator - the one that separates the last two vector elements (uses the value set in |
limit |
maximum character length (defaults to |
keep.trailing.zeros |
to show or remove trailing zeros in numbers |
missing |
string to replace missing values |
digits |
numeric (default: 2) passed to format |
round |
numeric (default: Inf) passed to round |
a string with concatenated vector contents
Aleksandar Blagotic
This function was moved from rapport
package: http://rapport-package.info.
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'
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.