If you do not want the blank lines, you can delete them.  Perhaps:

  (#~ [: +./"1 ~:&' ') fmtmat data

-- 
Raul

On Sun, Nov 27, 2011 at 9:20 AM, Skip Cave <[email protected]> wrote:

> Yes, the data is mixed. The first column is an integer, and the second
> column (and all subsequent columns) will be text.
>
> ;: inv"1 ts2    NB. Arie's first suggestion
> |domain error
> |       ;:inv"1 ts2
>
>     ; <@(LF ,~ ;:inv)"1 ] 8!:0 ts2     NB. Ric's suggestion
> |rank error
> |   ;<@(LF,~;:inv)"1]    8!:0 ts2
>
>     require 'tables/dsv'   NB. Ric's second suggestion
>     (' ';'') makedsv ts2
> 355  freeways
> 356  traffic
> 357  ninety one west
> 358  yes
> 361  sixty
>
> NB.  That works!
>
>  ; <@(LF ,~ ;:inv)"1 ts2  NB. Ric's third suggestion
> |domain error
> |   ;    <@(LF,~;:inv)"1 ts2
>
>   f =: 3 :'(":>{.y),'' '',>{:y'  NB. Eelvex's suggestion
>   f"1 ts2
> 355  freeways
> 356  traffic
> 357  ninety one west
> 358  yes
> 361  sixty
>
> NB. That works also!
>
>   fmtmat ts2       NB. Raul's suggestion
> 355  freeways
>
> 356  traffic
>
> 357  ninety one west
>
> 358  yes
>
> 361  sixty
>
>  That works, but with extra line feeds.
>
> Skip
>
> On Sun, Nov 27, 2011 at 6:55 AM, Raul Miller <[email protected]>
> wrote:
>
> > fmtmat=:3 :0
> >  r=. 0 0$t=. 9!:6''
> >  try.
> >    9!:7 ' '"0 t
> >    r=. ": y
> >  catch. end.
> >  9!:7 t
> >  d=. 1#~#$r
> >  d }. (-d) }. r
> > )
> >
> >   fmtmat ts2
> >
> > --
> > Raul
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
>
>
> --
> Skip Cave
> Cave Consulting LLC
> Phone: 214-460-4861
> ----------------------------------------------------------------------
> 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