[R-sig-finance] using yahoo and other data to calculate CAPM and FF betas
Gabor Grothendieck
ggrothendieck at gmail.com
Thu Apr 6 19:35:06 CEST 2006
On 4/6/06, Andrew West <jgalt70 at yahoo.com> wrote:
> I haven't been able to figure
> out how to prevent the function from crashing when one
> of the companies in the list has a late start or
> missing data. Aligning multiple time series into a
> panel data dataframe is tough for non-programmers like
> me!
If t1 and t2 are two ts class time series or two zoo series
then cbind(t1, t2) will create a multivariate series (2 columns)
In the case of zoo, merge(t1, t2) will also work.
na.omit(cbind(t1, t2)) or na.omit(merge(t1,t2))
will eliminate rows that have any NAs in the case of zoo series.
More information about the R-sig-finance
mailing list