Sorry, I didn't describe the problem very well. My goal is to express Data_2 in a simpler way. The code "Data_2(j) = sum(i$DATA(j,i),Data_1(i))" is more simplified than "Data_2("j1") = Data_1("i1"),...etc".
But the set DATA(j,i) need to set one by one. Is there a more simplified way to express it if ?

Yes, I need to map Data1(i) to Data2(j). The relationship between i and j are j=(i-1)*4-1.
In fact, if the Data1 will sample 15 minutes in a day (it will have 96 points).
The Data2 will take hourly data from Data1 (it will have 24 points).
So, if I don't have the simple way to write code, It will become Ex1 or Ex2 as following: