(</.~/)(]/:"1{:)(,:*) _3 1 0 1 _1 0 _10 _2 _4 6
+---------------+---+-----+
|_3 _1 _10 _2 _4|0 0|1 1 6|
+---------------+---+-----+

No need for 1+


R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: programming-boun...@jsoftware.com [mailto:programming-
> boun...@jsoftware.com] Namens John Randall
> Verzonden: woensdag 22 september 2010 19:42
> Aan: programming@jsoftware.com
> Onderwerp: [Jprogramming] Classification problem
> 
> I'm looking for help with a simple programming problem.
> 
> Suppose my data consists of integers, and I have a classification to a
> small number of values.
> 
> For example
> 
> f=:1+*
> data=:_3 1 0 1 _1 0 _10 _2 _4 6
> 
>     f data
> 0 2 1 2 0 1 0 0 0 2
> 
> I then want to organize the data into boxes based on these values, for
> example
> 
> +---------------+---+-----+
> |_3 _1 _10 _2 _4|0 0|1 1 6|
> +---------------+---+-----+
> 
> I got this using
> 
> (0 1 2=/f data) <@# data
> 
> Is there a simpler or better way?
> 
> Best wishes,
> 
> John
> 
> ----------------------------------------------------------------------
> 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