View source: R/HelperFunctions.R
pad0 | R Documentation |
Pad a vector with 0 to a desired length
pad0(v, l, value = 0, start = 0)
v |
the vector to pad with 0 |
l |
the desired (resulting) length of the vector |
value |
the value to pad with (if padding is needed). Default to 0, but can be overridden to pad with any other value. |
start |
the first |
returns the vector v
padded to length l
with value value
(default 0).
pad0(1:5, 7) # Pad to length 7 with zeroes pad0(1:5, 3) # no padding, but cut at length 3 # 3 leading zeroes, then the vector start (10 elements of vector, no additional padding needed): pad0(1:10, 13, start = 3) # padding with value other than zero: pad0(1:5, 7, value = "pad")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.