If you don't want to be at the mercy of your data's ordering, you could
selectively convert to numeric or not:
   isChar=: ' ' -: [: ({.) 0 $ ]
   ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6'
3 33 9 99 12 13 1 2 10 11 1000000
   >: ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6'
4 34 10 100 13 14 2 3 11 12 1000001

On Sat, Feb 25, 2023 at 4:39 PM Henry Rich <henryhr...@gmail.com> wrote:

> Now that gerund"n applies gerund cyclically, the need for the oblique
> trick is reduced.
>
> Henry Rich
>
> On 2/25/2023 3:26 PM, neit...@gaertner.de wrote:
> >> I want to convert the second one into numerical data
> >> Can you simplify the above expression?
> > Applying a gerund cyclically, as asked for in the subject:
> >
> >        ] list =. ;: 'foo 1 bar 2.17 baz 3.14'
> > +---+-+---+----+---+----+
> > |foo|1|bar|2.17|baz|3.14|
> > +---+-+---+----+---+----+
> >
> >     , ]`(".each)/.  list
> > +---+-+---+----+---+----+
> > |foo|1|bar|2.17|baz|3.14|
> > +---+-+---+----+---+----+
> >
> >     (,: datatype each)  , ]`(".each)/.  list
> > +-------+-------+-------+--------+-------+--------+
> > |foo    |1      |bar    |2.17    |baz    |3.14    |
> > +-------+-------+-------+--------+-------+--------+
> > |literal|boolean|literal|floating|literal|floating|
> > +-------+-------+-------+--------+-------+--------+
> >
> >
> > Obliquing over a vector is often overlooked.  It picks up every item
> > as a singleton "diagonal".  The final "," is required to compensate
> > for that.
> >
> >                                               Martin Neitzel
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to