[Jprogramming] filling in missing values
Matthew Brand
mtthwbrnd at googlemail.com
Thu Aug 13 19:30:19 HKT 2009
Thanks Dan.
2009/8/13 Dan Bron <j at bron.us>:
>> Suppose I have some data, and some default values to
>> use in case there is no data:
>> data =. a:,(1;2;3),a:,(3;2)
>> fill =. 10 20 30 40 50 60 70
>> The result I want is:
>> 10;1;2;3;50;3;2
>
> I prefer the mask}data,:fill idiom:
>
> (10;1;2;3;50;3;2) -: (data=a:)}data ,: <"0 fill
> 1
>
> (10;1;2;3;50;3;2) -: data (a:={.)`]}@:(,: <"0) fill
> 1
>
> -Dan
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
More information about the Programming
mailing list