Does (</.~ f) data  do what you want?

-Dan


Please excuse typos; composed on a handheld device.

-----Original Message-----
From: "John Randall" <rand...@andromeda.rutgers.edu>
Sender: programming-boun...@jsoftware.com
Date: Wed, 22 Sep 2010 13:41:35 
To: <programming@jsoftware.com>
Reply-To: Programming forum <programming@jsoftware.com>
Subject: [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