strexp | R Documentation |
Expand strings to a fixed ‘length’ (in the sense of
nchar
).
strexp(s, after, width, fill = " ", at)
s |
a character vector |
after |
character: a pattern, to be passed to |
width |
integer |
fill |
character |
at |
integer |
strexp
inserts blanks into the elements of a character vector
such that all elements have the same width
(i.e.
nchar
). Note that it will (currently) not contract a
string, only expand it.
a character vector
Enrico Schumann
strwrap
, format
## expand to width 10, but keep two initial blanks
s <- c(" A 1", " B 2")
strexp(s, after = " +[^ ]+ +", width = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.