[R-SIG-Finance] merging tseries with a table

aschmid1 aschmid1 at stevens.edu
Tue Sep 29 16:39:22 CEST 2015


I'm trying to merge prices obtained with get.hist.quote():
> head(mkt_prc)
            AdjClose
2009-01-02 36.21114
2009-01-05 36.04547
2009-01-06 36.42040
2009-01-07 35.34793
2009-01-08 35.40897
2009-01-09 34.67655

with data from a csv table:
> head(gdp_tab)
        Date Actual
1 1/31/2001    1.4
2 2/28/2001    1.1
3 3/29/2001    1.0
4 4/27/2001    2.0
5 5/25/2001    1.3
6 6/29/2001    1.2

I use command (as far as my imagination goes):
  x<-merge(gdp_tab, mkt_prc, by.x="Date", by.y=index(mkt_prc))

and it gives me an error:
Error in fix.by(by.y, y) : 'by' must match numbers of columns

Any suggestions on how to do this?
Thanks! Alec



More information about the R-SIG-Finance mailing list