[R-SIG-Finance] Problem with RBloomberg and xts.
John Laing
john.laing at gmail.com
Thu Sep 22 15:35:35 CEST 2011
Art,
The version of RBloomberg on CRAN (and therefore the version you're
using) is very old. Please do
install.packages("RBloomberg", repos = "r.findata.org")
for the most recent version.
Upgrading should help, but if you're still having issues after that
please let us know.
John
On Thu, Sep 22, 2011 at 8:48 AM, Artem Simonov <scherrzo at rambler.ru> wrote:
> 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.
>
> _______________________________________________
> 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.
>
More information about the R-SIG-Finance
mailing list