[R] Quick question on merging two time-series of different frequencies

Patnaik, Tirthankar tirthankar.patnaik at citi.com
Thu May 10 16:58:28 CEST 2007


Hi,
	A quick beginner's question. I have two time series, A with
daily data, and another B with data at varying frequencies, but mostly
annual. Both the series are sorted ascending.

I need to merge these two series together in the following way: For any
entry of A, the lookup should match with B until we find an entry of B
that's larger than A's. 

For all A[i], i = 1,...,N and B[j], j=1,...M

Match with B[j] where A[i] <= B[j]

When A[i] > B[j], match with B[j+1] where A[i] <= B[j+1]

Basically the less-frequent attributes stay true for a stock while the
daily prices change.

One example of this is the vlookup function in Excel with the TRUE
option. 

So we have an implementation of this in R?

TIA and best,
-Tir



More information about the R-help mailing list