Timeseries analysis on R

I am trying to run a time series analysis for both these data sets the relationship between daily crude oil and exchange rate from 2014 till 2017
I’ve gone through many r packages found online and time series codes found online but I still end up getting stuck
How do I go about running a code on R
I need help generating a code for such problem

Does this work for you in R, but not in RStudio? (see FAQ below for disambiguation)

Welcome to the forum!
There are lots of knowledgeable people here who would be happy to help, but to make that possible, they will need to know more about what you're trying to do.

I'm guessing you might be interested in visualizing the relationship between these two measures over time. The tidyverse set of packages makes it pretty straightforward to load the data, transform it into the structure you want, and visualize it. Or maybe you want to regress oil (prices, I'm guessing) against the exchange rate? In any case, you can get a good background for each of these steps in the R4DS book, available free online: