repChar | R Documentation |
Simple constructors of a constant character string from one character, notably a “blank” string of given string length.
M.M. is now ‘mentally deprecating’ bl.string
in
favor of using repChar()
in all cases.
With R 3.3.0 (May 2016), the new function
strrep()
was introduced; it is faster typically, and more
flexible, e.g. accepting a vector for the 2nd argument.
This (for now informally) deprecates all uses of repChar()
and bl.string()
.
repChar(char, no)
bl.string(no)
char |
single character (or arbitrary string). |
no |
non-negative integer. |
One string, i.e., character(1)
), for bl.string
a
blank string, fulfilling n == nchar(bl.string(n))
.
Martin Maechler, early 1990's (for bl.string
).
paste
, character
, nchar
.
r <- sapply(0:8, function(n) ccat(repChar(" ",n), n))
cbind(r)
repChar("-", 4)
repChar("_", 6)
## it may make sense to a string of more than one character:
repChar("-=- ", 6)
## show the very simple function definitions:
repChar
bl.string
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.