using getSymbols to load different start time variables (time series data)

1k views Asked by At
getSymbols(c("PI","RSXFS", "TB3MS", src="FRED",from="1959-1-1",  from="1992-1", from="1934-1-1")

How can I load data by using getSymbols for different start dates for multiple variables?

I needs 200 variables from FRED. I can download the FRED CODE easily, but the problem is that dates. Each variables have different starting date. First I load data set with time series format and then i will use window commend for fixing the same time period for all 200 data.

1

There are 1 answers

0
user227710 On BEST ANSWER

May be you are looking for mapply

symbols<-c("PI","RSXFS", "TB3MS")
begin.date<-c("1959-1-1","1992-1", "1934-1-1")
jj<- mapply(function(sym,dt) getSymbols(sym, src="FRED", from=dt,auto.assign = FALSE),symbols,begin.date)

head(jj[[3]])
           TB3MS
1934-01-01  0.72
1934-02-01  0.62
1934-03-01  0.24
1934-04-01  0.15
1934-05-01  0.16
1934-06-01  0.15