A=:".;._2]0 :0
0 0 0.034
1 25 0.059
1.4 55 0.094
2 85 0
)
2 2 1{"0 1 A
|length error
The length error is because the left argument has 3 items and the
right argument has four items. So you would be getting index 2 from
the first row of A, index 2 from the second row of A, index 1 from the
third row of A but what from the last row of A?
Inspecting your desired result, what I think you are really after is:
2 2 1{"0 1 |:A
1.4 55 0.059
I hope this helps,
--
Raul
On Wed, Aug 12, 2015 at 1:08 AM, David Lambert <[email protected]> wrote:
> I don't understand this rank error, the only unsatisfying explanation I
> think of is that amend works in place.
>
>
> 2 2 1{"0 1 A NB. goal
> 1.4 55 0.059
>
> 2#,:2 2 1
> 2 2 1
> 2 2 1
>
> (; $)@:|: A
> +------------+---+
> | 0 0 0.034|4 3|
> | 1 25 0.059| |
> |1.4 55 0.094| |
> | 2 85 0| |
> +------------+---+
> 2 2 1}"1 _ |:A
> 1.4 55 0.059
>
> (2#,:2 2 1)}"1 _ |:A
> |rank error
> | (2#,:2 2 1)}"1 _|:A
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm