str_pad2 | R Documentation |
Vectorised over string
, width
and pad
.
This is an internal function doing the same thing of str_pad()
function in package stringr
(except for parameters 'width'
and 'length'
which must be of length 1),
but without depending on package stringi
.
str_pad2(string, width, side = c("left", "right", "both"), pad = " ")
string |
A character vector. |
width |
Minimum width of padded strings. |
side |
Side on which padding character is added (left, right or both). |
pad |
Single padding character (default is a space). |
A character vector.
License: GPL 3.0
Luigi Ranghetti, phD (2019)
L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). "sen2r": An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data. Computers & Geosciences, 139, 104473. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.cageo.2020.104473")}, URL: https://sen2r.ranghetti.info/.
rbind(
str_pad2("hadley", 30, "left"),
str_pad2("hadley", 30, "right"),
str_pad2("hadley", 30, "both")
)
# All arguments are vectorised except side
str_pad2(c("a", "abc", "abcdef"), 10)
# Longer strings are returned unchanged
str_pad2("hadley", 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.