HI, May be this helps: ts1<- ts(1:20) ts2<- ts(1:25) ts1[-(1:3)]<- ts1[-(1:3)]+ts2[1:17]
as.numeric(ts1) # [1] 1 2 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 A.K. Hey everyone, I`m an absolut beginner in R and need some help for an exercise: I want to do ordinary calculations with 2 time series. The issue with this, that I want to use different elements of time series. Let me give you an example: I want to sum let`s say the 10th element of time series 1 with the 7th element of time series 2. And 9th element of TS 1 with 6th element of TS 2 and 8th element of TS 1 with 5th element of TS 2 ... This pattern of the summation should go all over the time series. Is there a function, which allows me to do this, if possible a function in which I can change the difference of the position with a variable. Thanks a lot for your support. I´m for any advice thankful! ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.