Skip to content

aligning dates from different sources

4 messages · Eric Thungstom, Joshua Ulrich, Jeff Ryan +1 more

#
On Sat, Jun 30, 2012 at 1:21 PM, Eric Thungstom
<eric.thungstrom at gmail.com> wrote:
cbind.xts simply calls merge.xts, so I'm not sure why you would expect
different results.

You could merge the two raw series, use na.locf to fill in the missing
values, then use apply.weekly to get the last value for each week:

x <- merge(ICSA,Ad(GSPC))
x <- na.locf(x)
y <- apply.weekly(x, last)
<snip>

Best,
--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com
#
Or you could simply change the index explicitly:
ICSA
Sat 208000
Sat 207000
Sat 217000
Sat 204000
Sat 216000
Sat 229000
ICSA
Fri 208000
Fri 207000
Fri 217000
Fri 204000
Fri 216000
Fri 229000
ICSA
1967-01-06 208000
1967-01-13 207000
1967-01-20 217000
1967-01-27 204000
1967-02-03 216000
1967-02-10 229000
HTH
Jeff
On Sat, Jun 30, 2012 at 1:39 PM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote: