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!
Thanks a lot! It works like I want to! Am 29.08.2013 15:44 schrieb "arun kirshna [via R]" < ml-node+s789695n4674877h96@n4.nabble.com>:> 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! > > ______________________________________________ > [hidden email] <user/SendEmail.jtp?type=node&node=4674877&i=0>mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > r.789695.n4.nabble.com/Calculation-with-Times-Series-tp4674852p4674877.html > To unsubscribe from Calculation with Times Series, click here<r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4674852&code=Yy5icmVua2VuQGdtYWlsLmNvbXw0Njc0ODUyfDk2MDYzMzE=> > . > NAML<r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html!nabble:email.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers!nabble:email.naml-instant_emails!nabble:email.naml-send_instant_email!nabble:email.naml> >-- View this message in context: r.789695.n4.nabble.com/Calculation-with-Times-Series-tp4674852p4674956.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
Seemingly Similar Threads
- Help with a loop
- how to optimise cross-correlation plot to study time lag between time-series?
- concatenating two successive time series
- Estimate Intercept in ARIMA model
- n Realizations of a Stochastic Process assigned to dynamically generated variable names?