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 7635923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:32:54+00:00 2026-05-31T07:32:54+00:00

I have one main XTS object Data with ~1M rows spanning 22 days. I

  • 0

I have one main XTS object “Data” with ~1M rows spanning 22 days. I have another XTS object “Set” with 22 rows, with 1 entry per day. I would like to combine this smaller XTS object into the larger one, such that it would have an additional column containing the value in Set for that day.

First I tried:

> Data=cbind(Data,as.numeric(Set[as.Date(index(Data[]))]))
Error in error(x, ...) : 
improper length of one or more arguments to merge.xts

Then I tried:

> Data=cbind(Data,1)
> Data[,6]=as.numeric(Set[as.Date(index(Data[,6]))])
Error in NextMethod(.Generic) : 
  number of items to replace is not a multiple of replacement length

I also tried without the as.numeric but received the same error. I tried turning Data into a data.frame and got the error:

Error in `[<-.data.frame`(`*tmp*`, , 6, value = c(1, 397.16, 397.115,  : 
  replacement has 22 rows, data has 835771

What am I doing wrong and how do I make this happen? I’ve only been using R the past two weeks.

Thanks!

> str(Data)
An ‘xts’ object from 2012-01-03 05:01:05 to 2012-01-31 14:59:59 containing:
  Data: num [1:835771, 1:5] 397 397 397 397 397 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:5] "SYN" "\"WhitePack.BID_SIZE\"" "\"WhitePack.BID_PRICE\"" "\"WhitePack.ASK_PRICE\"" ...
  Indexed by objects of class: [POSIXct,POSIXt] TZ: 
  xts Attributes:  
 NULL
> str(Set)
An ‘xts’ object from 2012-01-02 to 2012-01-31 containing:
  Data: chr [1:22, 1] "  1.000" "397.160" "397.115" "397.175" "397.200" "397.390" "397.560" "397.580" "397.715" ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr "Settle"
  Indexed by objects of class: [POSIXct,POSIXt] TZ: 
  xts Attributes:  
 NULL
  • 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-31T07:32:55+00:00Added an answer on May 31, 2026 at 7:32 am

    Do you get success with :

    df3 <- merge(Data, Set)
    

    To address my lack of full understanding of the original problem, I think the only additional step would be:

    df3[, 6]  <- na.locf( df3[, 6] )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one main array which is the returned data from a MySQL query
I'm writing an application in WPF. I have one main thread and another one
I do have my program running in a network. I have set one main
My application is set up using ViewFlipper so that I have one main View
I have one main parent swf that loads several other swfs. If something happens
I have one main outstanding issue, I know now how to databind to lists
I have WPF Application where I have One main form and other user controls
I have a design of activities like this I have one main activity and
We are installing out program via inno setup. We have one main exe file,
I have a one main Workflow which calls several activities asynchronously. Some of the

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.