(,.newcol) (,1) }"1 table
+---------+------+
|taa |mean |
+---------+------+
|ewe |to |
+---------+------+
|tweqewqwq|been |
+---------+------+
|fgsaera |formed|
+---------+------+
Perhaps more clear when you have newcol(s) and are
amending more than one column - e.g.
(4 2$newcol) (1 3) }"1 table,. table
+---------+----+---------+------+
|taa |mean|taa |to |
+---------+----+---------+------+
|ewe |been|ewe |formed|
+---------+----+---------+------+
|tweqewqwq|mean|tweqewqwq|to |
+---------+----+---------+------+
|fgsaera |been|fgsaera |formed|
+---------+----+---------+------+
At 17:20 +1300 2007/02/07, Sherlock, Ric wrote:
Hi,
Am new to J (from APL) and am having trouble with selective assignment .
I understand that in J the equivalent is to use Amend.
Given:
]table=.4 2$ ;:'taa tas ewe wtw tweqewqwq 4212 fgsaera jihjy'
]newcol=. ;:'mean to been formed'
]newrow=. ;:'thra rowskd'
Lets say I want to replace the 2nd column of table with a new column.
The following works:
newcol (0 1;1 1;2 1;3 1)}table
But this doesn't:
newcol 1}"1 table
|rank error
| newcol 1}"1 table
But does work for a row
newrow 1} table
Or
newrow 1}"2 table
The following works but seems cludgey
|: newcol 1} |: table
I have a feeling that maybe my understanding of rank isn't quite right
yet! Can anyone help?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm