Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8266763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:16:39+00:00 2026-06-08T05:16:39+00:00

I’ve observed that for many operators on overlapping time series, the result is given

  • 0

I’ve observed that for many operators on overlapping time series, the result is given only for the overlapping portion, which is nice:

> (ts1 <- ts(1:5, start=1, freq=3))
Time Series:
Start = c(1, 1) 
End = c(2, 2) 
Frequency = 3 
[1] 1 2 3 4 5
> (ts2 <- ts((7:3)^2, start=2, freq=3))
Time Series:
Start = c(2, 1) 
End = c(3, 2) 
Frequency = 3 
[1] 49 36 25 16  9
> ts1 + ts2
Time Series:
Start = c(2, 1) 
End = c(2, 2) 
Frequency = 3 
[1] 53 41

However, this doesn’t seem to be the case with cbind(). While the output is aligned properly, NAs are created for the non-overlapping data:

> (mts <- cbind(ts1, ts2))
Time Series:
Start = c(1, 1) 
End = c(3, 2) 
Frequency = 3 
         ts1 ts2
1.000000   1  NA
1.333333   2  NA
1.666667   3  NA
2.000000   4  49
2.333333   5  36
2.666667  NA  25
3.000000  NA  16
3.333333  NA   9

Is there a way to perform that cbind() without creating the rows with NA in them? Or if not, what’s a good way to take the result and strip off the rows with the NAs? It’s not a simple matter of subscripting, because then it loses its timeseries nature:

> mts[complete.cases(mts),]
     ts1 ts2
[1,]   4  49
[2,]   5  36

Maybe something with window(), but calculating the start & end times for the window seems a little yucky. Any advice is welcome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:16:41+00:00Added an answer on June 8, 2026 at 5:16 am

    Why not just na.omit the result?

    > na.omit(cbind(ts1,ts2))
    Time Series:
    Start = c(2, 1) 
    End = c(2, 2) 
    Frequency = 3 
             ts1 ts2
    2.000000   4  49
    2.333333   5  36
    

    If you want to avoid na.omit, stats:::cbind.ts calls stats:::.cbind.ts, which has a union argument. You could set that to FALSE and call stats:::.cbind.ts directly (after creating appropriate arguments):

    > stats:::.cbind.ts(list(ts1,ts2),list('ts1','ts2'),union=FALSE)
    Time Series:
    Start = c(2, 1) 
    End = c(2, 2) 
    Frequency = 3 
             ts1 ts2
    2.000000   4  49
    2.333333   5  36
    

    But the na.omit solution seems a tad easier. 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.