powered by
Take a vector of any length and then intersperse zeroes between existing elements (and add a further zero to the end).
zeropad(x)
A vector whose odd elements are just x and whose even elements are zeroes.
x
Vector that you want to intersperse zeros into.
G.P. Nason
Title says it all.
hwt
# # Operate on a test set # v <- 1:3 zeropad(v) #[1] 1 0 2 0 3 0
Run the code above in your browser using DataLab