powered by
Calculating correlation of two vectors with lag and lead periods. The correlations are used to determine the lag or lead effect between two variables. The correlation function uses "na.or.complete" method and calculate the Pearson's correlation.
cor.lag(x,y,lag,lead)
:the moving vector
:the fixed vector
:number of lag periods
:number of lead periods
# NOT RUN { cor.lag(mtcars[,1],mtcars[,2],3,3) # }
Run the code above in your browser using DataLab