I've been playing with the readcvs function and am having a problem with
the boxed data. I can read in a 2 dimensional array of boxed character
data. I can select any particular column using
col =. idx {"_1 myboxeddata
The problem comes in when I want to test each of the boxes in the column
to see which one is equal to the single number 1 (as a character of
course). I would like to generate an array of 1s and 0s, the 1s being
where the number 1 character is. I would like to do this in the
following fashion
col = <'1'
But I always get 0s as the answer even though the boxed list contains a
single boxed 1 character
I've recreated the problem in simpler form:
mydata =. |: ;: 1 ]\'0123456789'
mydata
│0│1│2│3│4│5│6│7│8│9│
mydata = <'1'
0 0 0 0 0 0 0 0 0 0
$mydata
1 10
So because this horizontal format of mydata was transposed from a column
the shape is a little different than if I built this directly using ;
lin =. '0';'1';'2';'3';'4';'5';'6';'7';'8';'9'
lin
│0│1│2│3│4│5│6│7│8│9│
$lin
10
lin = <'1'
0 1 0 0 0 0 0 0 0 0
which works the way I suspect. Even if I use take ({.) to get the
dimensions of the boxed list mydata the same as lin in the previous
example I still get all 0s:
{. mydata
│0│1│2│3│4│5│6│7│8│9│
${. mydata
10
({. mydata) = <'1'
0 0 0 0 0 0 0 0 0 0
So what is going on here that I am missing?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm