R/shift.vec.r

Defines functions shift.vec

Documented in shift.vec

##############################
## ---- Shift a Vector ---- ##
###                        ###
## Given a vector and delay ##
## time, shift that vector  ##
##############################

shift.vec <- function(shift,vec) {
    n <- length(vec)
    vec.new <- rep(NA, n)
    if (shift < 0) {
        vec.new[1:(n-abs(shift))] <- vec[(abs(shift)+1):n]
    } else if (shift > 0) {
        vec.new[(shift+1):n] <- vec[1:(n-shift)]
    } else {
        vec.new <- vec
    }
    return(vec.new)
}

Try the imagefx package in your browser

Any scripts or data that you put into this service are public.

imagefx documentation built on Feb. 14, 2020, 1:07 a.m.