Not sure if this is for personal use, work or school, but do be aware of our homework policy, FAQ: Homework Policy
A good place to start helping you out is by showing how you've approached this. Right now I'm not sure where you're having trouble. There are a number of R packages and online tutorials that will help you get set up (mostly university course resources pages associated with time series courses). For example, the testcorr package implements what you're trying to achieve, here's that package's vignette.