---Hahn, Harvey wrote:
> Ric Sherlock wrote:
> |Not sure if the above is a typo, but in case it is not - the
> |left argument to the grid verb should be a boxed 2-column
> |matrix/table (if it is not a 2-column matrix, then the verb
> |expects the left argument to be header labels for the header
> |rows and columns). The first column should contain the option
> |name, the 2nd column the option value.
> |  (,:'NAME1';value1 ) grid data
> |  (('NAME1';value1),('NAME2';value2),:'NAME3';value3 ) grid data
> 
> It wasn't a typo, and that's why I wish there were more examples for
> things.  I was taking a stab at the syntax.  For virtually everybody
> here, I'm sure the above is a "second nature" kind of pattern (just as
> in spoken languages).  I know what a boxed 2-column name/value matrix
> would look like, but I don't necessarily know the complete pattern for
> *creating* one out of the blue--and I didn't have time to spend to try
> 101 variations before I hit the winning move.  Admittedly, trial and
> error is one way of learning (and having the learning "stick" with
> you).

Firstly I agree that more examples would help make working out how to use the 
various Grid (& Plot) options clearer. Setting a single option is certainly a 
trap for beginners.
  i.e. not:
   ('GRIDZOOM';0.5) grid data
  But:
   (,:'GRIDZOOM';0.5) grid data

But if you already know what a boxed 2-column name/value matrix looks like, 
then it is pretty easy to know whether you have got it right or not by just 
executing the left argument in the session and seeing if the result is a 
2-column name/value matrix. If not, you can either experiment or ask on the 
forum. There are many ways to do it though - here are three.
 
   (;:'NAME1 NAME2 NAME3 NAME4') ,. 'val1';45 6;0;'val4'
+-----+----+
|NAME1|val1|
+-----+----+
|NAME2|45 6|
+-----+----+
|NAME3|0   |
+-----+----+
|NAME4|val4|
+-----+----+
      (('NAME1';'val1'),('NAME2';45 6),('NAME3';0),:'NAME4';'val4' )
+-----+----+
|NAME1|val1|
+-----+----+
|NAME2|45 6|
+-----+----+
|NAME3|0   |
+-----+----+
|NAME4|val4|
+-----+----+
   NAME1=. 'val1'
   NAME2=. 46 6
   NAME3=. 0
   NAME4=. 'val4'
   pack 'NAME1 NAME2 NAME3 NAME4'
+-----+----+
|NAME1|val1|
+-----+----+
|NAME2|46 6|
+-----+----+
|NAME3|0   |
+-----+----+
|NAME4|val4|
+-----+----+

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

Reply via email to