Is this what you want?

   dates
2010 1 1
2010 1 2
2010 1 3
2010 1 4

2009 1 1
2009 1 2
2009 1 3
2009 1 4

2010 1 1
2010 1 2
2010 1 3
2010 1 4
   hours
0 15
0 30
0 45
0 60
   $,/"3 dates ,"1"1 2 hours
3 16 5

On Tue, Dec 28, 2010 at 11:06 AM, Bill Harris
<bill_har...@facilitatedsystems.com> wrote:
> I've been working in R too long, and my J is rusty.
>
> I'm trying to take what seems like the Cartesian product of two
> arrays. In particular, I've got a list of lists of dates, and I want
> to turn them into ISO timestamps with a consistent HMS appended to them.
>
> The dates list might look like
>
> dates =: 1 4 3 $ 2010 01 01 2010 01 02 2010 01 03 2010 01 04
> dates =: dates, 4 3 $ 2009 01 01 2009 01 02 2009 01 03 2009 01 04
> dates =: dates, 4 3 $ 2010 01 01 2010 01 02 2010 01 03 2010 01 04
>
> That's 3 sets of data, each with 4 dates, and each date with 3
> components. (In general, each set of data could have a different
> number of dates.)
>
> The complete hours list looks like
>
> hoursmins=: 24 (<95 0) } 24 60 #: 15 * >: i. 96
>
> but a simple version for this example might only have 4 times:
>
> hours =: 4 2 $ 0 15 0 30 0 45 0 60
>
> What I want looks roughly like
>
> 2010 01 01 00:15:00.00
> 2010 01 01 00:30:00.00
> 2010 01 01 00:45:00.00
> 2010 01 01 00:60:00.00
> 2010 01 02 00:00:00.00
> .
> .
> .
> 2010 01 04 00:60:00.00
>
> 2009 01 01 00:15:00.00
> .
> .
> .
>
> The last step needs the isotimestamp verb from dates, so I need to get
> to lines of the form
>
> 2010 01 01 0 15
> 2010 01 01 0 30
>
> and so forth. The rank of that result should be 3 16 5: 3 sets of 16
> date-time stamps, each with 5 components.
>
> I've tried lots of alternatives, including variants on catalog and on
> Henry's JfC ,"_1 _ "_ _1, all to no avail. I suspect it's trivial; can
> someone help?
>
> Thanks,
>
> Bill
>
> PS: I apologize if this comes through twice.  I originally sent it from
> the wrong email address, which I suspect will get it blocked.
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to