merge.xts problem
Hi Joshua, I did some additional research and found that the command below, which tries to shift the index by 3 days, creates a problem and does not allow to the 2 datasets to be combined. #shift the index index(weekly)<-index(weekly)+3 This used to work in the previous version but not anymore. Attached you will find the datasets and r code. Nikos
On 2/13/2013 6:55 AM, Joshua Ulrich wrote:
Nikos, Please provide a minimal reproducible example. For examples of how to do this, see: http://stackoverflow.com/q/5963269/271616 Best, -- Joshua Ulrich | about.me/joshuaulrich FOSS Trading | www.fosstrading.com R/Finance 2013: Applied Finance with R | www.RinFinance.com On Tue, Feb 12, 2013 at 11:34 PM, Nikos Rachmanis <nikos.rachmanis at gmail.com> wrote:
Hi all,
Just wondering if someone has come across this problem with the
merge.xts function after updating from 0.8-6 to 0.9-3 version.
I am trying to merge 2 xts objects one with daily observations and
another one with weekly.
With the older packet and the following command:
tradedata<-merge.xts(timeseries.daily,timeseries.daily,join="left")
the merge is done fine. With the new one does not work and although puts
together the 2 datasets shows all the incoming observations as NA.
Daily dataset
Dates IMM0ECOL Index IMM0ECOS Index IMM0ENCL Index
12/26/2000 4316 38769 26834
1/2/2001 5495 29995 15885
1/9/2001 5786 41915 21845
1/16/2001 6866 41480 19696
Weekly dataset
Index SP1.OPEN SP1.HIGH
1/2/1990 356.35 362.85
1/3/1990 363.25 364.8
1/4/1990 361.4 362.6
1/5/1990 359.2 359.6
1/8/1990 354.1 358.4
1/9/1990 357.8 358.1
1/10/1990 351.9 353.2
1/11/1990 352.4 353.5
Has the command changed?
Thanks,
Nikos
[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
-------------- next part -------------- A non-text attachment was scrubbed... Name: 000.SPX.csv Type: application/vnd.ms-excel Size: 26759 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20130214/7078c280/attachment.xlb> -------------- next part -------------- A non-text attachment was scrubbed... Name: 001.S&P_Commit.csv Type: application/vnd.ms-excel Size: 5201 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20130214/7078c280/attachment-0001.xlb> -------------- next part -------------- #################################################################################################################### ### Libraries + Settings ########################################################################################### #################################################################################################################### #Clear memory rm(list=ls()) #Increase display buffer (only when it is used with display opearations) options(max.print=5E8) #Common Libraries library(xts) #Read the files data01=read.csv("000.SPX.csv", sep=",", header=TRUE) data02=read.csv("001.S&P_Commit.csv", sep=",", header=TRUE) #Create the xts using the constructor daily<-xts(data01[,-1],as.Date(data01[,1],"%m/%d/%Y")) #replace NA with zeros(0) in Commit data02<-replace(data02,is.na(data02),0) #Create the xts using the constructor weekly<-xts(data02[,-1],as.Date(data02[,1],"%m/%d/%Y")) #shift the index index(weekly)<-index(weekly)+3 #merge the 2 datasets tradedata<-merge.xts(daily,weekly,join="left")