padarray | R Documentation |
Pad array.
padarray(A, padsize, padval=0, direction=c("both", "pre", "post"))
A |
vector, matrix, or array to be padded | |||||||
padsize |
integer vector specifying both amount of padding and the dimension along which to add it | |||||||
padval |
scalar value specifying pad value, which defaults to 0.
| |||||||
direction |
character string specifying direction to apply padding.
|
This is an S4 generic function.
Return value is the same type as argument A
with requested padding.
P. Roebuck proebuck1701@gmail.com
padarray(1:4, c(0, 2)) # 0 0 [1 2 3 4] 0 0
padarray(1:4, c(0, 2), -1) # -1 -1 [1 2 3 4] -1 -1
padarray(1:4, c(0, 2), -1, "post") # [1 2 3 4] -1 -1
padarray(1:4, c(0, 3), "symmetric", "pre") # 3 2 1 [1 2 3 4]
padarray(letters[1:5], c(0, 3), "replicate") # a a a [a b c d e] e e e
padarray(letters[1:5], c(0, 3), "circular", "post") # [a b c d e] a b c
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.