[R-SIG-Finance] Problem with RBloomberg and xts.

Artem Simonov scherrzo at rambler.ru
Thu Sep 22 14:48:05 CEST 2011


Dear friends!

I'm trying to get some time series with RBloomberg and then merge them
using merge.xts function

the code is the following:

#install.packages(c("RBloomberg","xts"))
library(RBloomberg)
library(xts)
blpConnect()
symbol1<-"OGZD LI Equity"
symbol2<-"LKOD LI Equity"
s<-as.chron("2011-01-10")
e<-as.chron("2011-07-12")
ts1 <- blpGetData(conn, symbol1, "PX_LAST",
start=s,end=e)
ts2<- blpGetData(conn, symbol2, "PX_LAST",
start=s,end=e)

a_ts1<-index(ts1)
b_ts1<-as.double(ts1)
c_ts1<-as.Date(a_ts1)
m1_ts1<-matrix(b_ts1)
aa1_ts1<-as.POSIXct(c_ts1)
a11_ts1<-xts(m1_ts1,aa1_ts1)

a_ts2<-index(ts2)
b_ts2<-as.double(ts2)
c_ts2<-as.Date(a_ts2)
m1_ts2<-matrix(b_ts2)
aa1_ts2<-as.POSIXct(c_ts2)
a11_ts2<-xts(m1_ts2,aa1_ts2)

e1<-merge.xts(a11_ts1,a11_ts2,method="inner")

I've got the following warning messages:

Warning messages:
1: In merge.xts(a11_ts1, a11_ts2, method = "inner") :
  NAs introduced by coercion
2: In merge.xts(a11_ts1, a11_ts2, method = "inner") :
  NAs introduced by coercion

Could you please tell me what I am doing wrong or probably a shorter way
to merge two or more time series, downloaded with RBloomberg and which
may have different number of points?

Thank you in advance!

Kind regards,
Art Simonov,
London.



More information about the R-SIG-Finance mailing list