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

  • Home
  • SEARCH
  • 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 4238948
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:58:15+00:00 2026-05-21T02:58:15+00:00

I have 2 zoo objects – Interest rate spread between 10-YR-US-Treasury and 2-YR-US-Treasury (object

  • 0

I have 2 zoo objects –

  1. Interest rate spread between 10-YR-US-Treasury and 2-YR-US-Treasury (object name = sprd)

  2. S&P 500 index (object name = spy)

> str(spy)
‘zoo’ series from 1976-06-01 to 2011-03-31
  Data: num [1:8791] 99.8 100.2 100.1 99.2 98.6 ...
  Index: Class 'Date'  num [1:8791] 2343 2344 2345 2346 2349 ...

> str(sprd)
‘zoo’ series from 1976-06-01 to 2011-03-31
  Data: num [1:9088] 0.68 0.71 0.7 0.77 0.79 0.79 0.82 0.86 0.83 0.83 ...
  Index: Class 'Date'  num [1:9088] 2343 2344 2345 2346 2349 ...

Since there are NA data points in object ‘sprd’ I created another object that omits “NA”. The name of that object is ‘sprdtmp’.

> str(sprdtmp)
‘zoo’ series from 1976-06-01 to 2011-03-31
  Data: atomic [1:8704] 0.68 0.71 0.7 0.77 0.79 0.79 0.82 0.86 0.83 0.83 ...
 - attr(*, "na.action")=Class 'omit'  int [1:384] 25 70 95 111 118 128 149 190 224 260 ...
  Index: Class 'Date'  num [1:8704] 2343 2344 2345 2346 2349 ...

I want to plot both time series on the same plot with time/date on the x-axis and the axis label quarterly. One problem is the sprdtmp and spy objects do not have the same number of data points as there are times when the equity markets are closed while the interest rate markets are open. For the most part the dates overlap. Would this matter if I try to plot both on the same plot? And how would I go about plotting these objects in one plot.

The second part of the plot requires that both are on different scales. I guess I could take a log of the s&p and plot that along with the rate spread. But it would be nice for future reference how I could plot 2 series in one plot with 2 difference scales.

I spent all night yesterday and this morning trying various options but I cant seem to get it to work. I would greatly appreciate your help.

  • 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-05-21T02:58:16+00:00Added an answer on May 21, 2026 at 2:58 am

    The following did the trick:

    plot(na.approx(cbind(z1, z2)), screen = 1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be exceptionally simple. I have a zoo object with 500 times series
I have a yearmon object: require(zoo) date1 <- as.yearmon(Mar 2012, %b %Y) class(date1) #
Have 2 tables for example: In 1st: object & parent columns object | parent
I have a zoo object oi.zoo with weekly data. I would like to sooth
I've a zoo object, with a yearqtr index, covering about 50 years. When plotted
I have the following url /index.php?option=com_zoo&task=item&item_id=292&Itemid=283 What I want to do to replace item_id
If I have some multivariate irregular time series, such as zoo or xts objects
I have a zoo object in R that has daily data and is missing
I have a zoo time series object, vels : 2011-05-01 00:00:00 7.52 2011-05-01 00:10:00
I have 82 .csv files, each of them a zoo object, with the following

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.