I have two files which contain time series in this format:
Tag, T1, T2, ... Tn
Stock-1, 2, 3, .. 6
Stock-2, 3, 2, .. 7
.
.
Stock-m, 2, 1, .. 9
In R, for any tag (ex. Stock-x) I want to take related arrays from both files and calculate cross correlation(ccf) for them. How I can do that ?
Note: If it would be easier, I can change the file format.
Update:
I read from file into data.frames with this:
file1 = read.table("file1.txt", header = TRUE, sep = ",")
How will I reach to specific rows with Tag name such as “Stock-5” ?
I removed the “Tag” from the files:
Then I was able get results with this R code: