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

From: Patnaik, Tirthankar <tirthankar.patnaik_at_citi.com>
Date: Thu, 10 May 2007 20:28:28 +0530


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



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 10 May 2007 - 15:02:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 10 May 2007 - 17:31:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.