Skip to content
Prev 13525 / 15274 Next

merging tseries with a table

On Tue, Sep 29, 2015 at 9:39 AM, aschmid1 <aschmid1 at stevens.edu> wrote:
Convert gdp_tab to zoo before you merge.

gdp_tab <- read.table(text="Date Actual
1/31/2001 1.4
2/28/2001 1.1
3/29/2001 1.0
4/27/2001 2.0
5/25/2001 1.3
6/29/2001 1.2", header=TRUE, as.is=TRUE)
library(zoo)
z <- zoo(gdp_tab$Actual, as.Date(gdp_tab$Date, "%m/%d/%Y"))
mkt_prc <- tseries::get.hist.quote("SPY")
x <- merge(mkt_prc, z)