Skip to content
Prev 278225 / 398503 Next

Missing data?

Also with to.weekly there seems to be a problem with when the week starts.
For example:
as.Date("2011-10-09"), as.Date("2011-10-10")), frequency=52)
xts.ts.Open xts.ts.High xts.ts.Low xts.ts.Close
2011-01-01           1           1          1            1
2011-01-10           2           2          2            2
2011-10-09           3           3          3            3
2011-10-10           4           4          4            4
as.Date("2011-10-09"), as.Date("2011-10-10")), frequency=52)
xts.ts.Open xts.ts.High xts.ts.Low xts.ts.Close
2011-01-02           1           2          1            2
2011-10-09           3           3          3            3
2011-10-10           4           4          4            4

So in the first case the week ends on January 1st. But the second indicates
that the end of the week is the 2nd but it includes the data from the first.
I would expect that the first column should be consistent.
Notice that 10-09 and 10-10 are properly considered different weeks because
the 9th is a Sunday and the 10th is a Monday (the beginning of the week).

-----Original Message-----
From: R. Michael Weylandt <michael.weylandt at gmail.com>
[mailto:michael.weylandt at gmail.com] 
Sent: Tuesday, November 22, 2011 3:10 PM
To: Kevin Burton
Cc: <r-help at r-project.org>
Subject: Re: [R] Missing data?

Couldn't you use seq.Date() to set up the time index and then just fill as
appropriate?

Alternatively, to.weekly if you are starting with a daily series. 

Michael

On Nov 22, 2011, at 4:00 PM, "Kevin Burton" <rkevinburton at charter.net>
wrote:
series.
end date.