padders {invctr} | R Documentation |
Padd vector by index
Description
Padd vector by index
Pad vector front
Pad vector rear
Pad vector front + rear
Usage
x %[+% j
x %+]% j
x %[+]% j
Arguments
x |
A vector |
j |
A one, or two element vector. One element: Pad |
Value
A padded version of x
Examples
x <- rnorm(100)
# Pad front with 10 zeros
x%[+%10
# Same as
x%[+%c(10,0)
# Pad rear with zeros
x%+]%10
# Same as
x%+]%c(10,0)
# Pad front + rear with NA
x%[+]%c(NA,10)
# Pad front + rear of a character vector
"yes"%[+]%c(2,"no")
"yes"%[+]%c(1,"no")
"yes"%[+]%c(0,"no")
[Package invctr version 0.2.0 Index]