I really need to stop and step back on this, but...

your machine seemed to be in much better shape than mine:

   6!:2 '''headers data'' =:readCsv file'
31.7457

(That's with your implementation of readCsv)

Interestingly, later runs were consistently better:

   6!:2 '''headers data'' =:readCsv file'
5.78703
   6!:2 '''headers data'' =:readCsv file'
5.71423

That said, here is how I think I would implement readCsv:

readCsv =: 3 : 0
   txt =. fread y
   cols =. ',' cut 0 {:: LF cut 4000 {. txt
   (-#cols)]\ (',',LF) (e.~ ];._1 ]) LF,txt
)

I don't know if that works with the rest of your document - probably
not - but it seems to me like the natural approach.

That said, this is a bit slower than your approach:

   6!:2 'headers=:{. data =:readCsv file'
7.56351
   6!:2 'headers=:{. data =:readCsv file'
7.22873

I really need to take a step back and digest what you've written...

Thanks,

-- 
Raul

On Fri, Sep 11, 2015 at 8:05 PM, Raul Miller <[email protected]> wrote:
> Oh, I see what you are doing  - that first line was just for the headers.
>
> And I haven't looked at the data to make sure it has a trailing newline.
>
> I guess I should download the data and try it myself.
>
> --
> Raul
>
> On Fri, Sep 11, 2015 at 8:04 PM, Raul Miller <[email protected]> wrote:
>> your readcsv implementation in 2.2.1 has:
>>
>>   cols =. ',' cut 0 {:: LF cut 4000 {. txt
>>
>> I expect that it should be more like:
>>
>>    cols=. ','&cut;._2 txt
>>
>> (Still reading it, but I need to get something to eat...)
>>
>> Thanks,
>>
>> --
>> Raul
>>
>> On Fri, Sep 11, 2015 at 6:19 PM, Joe Bogner <[email protected]> wrote:
>>> I've published a draft of an essay on data analysis in J using J, Jd and my
>>> MicroJ interpreter.
>>>
>>> http://csilo.com/static/DataAnalysisWithJ.html
>>>
>>> This is a first draft so I welcome any comments. I can cross post to
>>> programming if that's appropriate as well (let me know).
>>>
>>> Thanks,
>>> Joe
>>> ----------------------------------------------------------------------
>>> 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