How to split a daily DateList by week? --> Solved
- To: mathgroup at smc.vnet.net
- Subject: [mg114866] How to split a daily DateList by week? --> Solved
- From: "Sohn Hyun-U" <hsohn at student.ethz.ch>
- Date: Tue, 21 Dec 2010 00:17:17 -0500 (EST)
Hi there,
I just answered my own question...
Given a DateList ts, one can split it by calendar month simply using
SplitBy[ts, #[[1, {1, 2}]] &]
instead of my crummy first try.
To split by calendar week, I found a function called ISOWeek in this group (https://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/3dbc03f1f113b370/18e87e147589ebfe?hl=bn&lnk=gst&q=week#18e87e147589ebfe) which can then be used analogously like
SplitBy[ts, #[[1, 1]] && ISOWeek[#[[1]]] &]
Kind regards,
Hyun-U Sohn