This doesn't answer you actual question but you may find the essay on working with inverted tables useful. http://www.jsoftware.com/jwiki/Essays/Inverted_Table
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Lettow, Kenneth > Sent: Saturday, 16 February 2008 10:56 > To: Programming forum > Subject: RE: [Jprogramming] Rank Question > > (reformatted the original) > > Hi, > > I have a question about composing functions. I have the > following scenario. > > 1. I read in a csv file. > 2. I split the array its constituent columns. > 3. The columns are a mix of text and number data. > 4. I wrote two verbs that gives me the nub, frequency, and > % of total for items in the array. > > nfpt=:([: <"1 ~.) ,. ([: <"0 #/.~) ,. [: <"0 #/.~ % # NB. > For Text columns > nfpt2=:([: <"0 ~.) ,. ([: <"0 #/.~) ,. [: <"0 #/.~ % # NB. > For Numeric columns > > examples: > > /:~nfpt2 ? 1000 $ 100 > ┌──┬──┬─────┐ > │0 │11│0.011│ > ├──┼──┼─────┤ > │1 │7 │0.007│ > ├──┼──┼─────┤ > │2 │13│0.013│ > ├──┼──┼─────┤ > │3 │14│0.014│ > ├──┼──┼─────┤ > > /:~nfpt event_type_name > ┌─────────┬─────┬─────────┐ > │Call │4029 │0.120484 │ > ├─────────┼─────┼─────────┤ > │Email │1830 │0.0547249│ > ├─────────┼─────┼─────────┤ > │Web_Event│27581│0.824791 │ > └─────────┴─────┴─────────┘ > > > As you can see, I have explicit ranks of (1, 0, 0) for the > text version , and (0, 0, 0) for the numeric.. > I want to be able to get rid of these explicit ranks. I've > tried things like > > nfpt3=:([: <"( <:[EMAIL PROTECTED]) ~.) ,. ([: <"( <:[EMAIL PROTECTED]) #/.~) > ,. [: <"( > <:[EMAIL PROTECTED]) #/.~ % # NB. ( <:[EMAIL PROTECTED]) replaces explicit > rank.. > > but the results I get are not what I am looking for. > > /:~nfpt3 event_type_name > ┌─────────┬───────────────────────────┐ > │Call │0.120484 0.0547249 0.824791│ > │Email │ │ > │Web_Event│ │ > ├─────────┼───────────────────────────┤ > │Call │4029 1830 27581 │ > │Email │ │ > │Web_Event│ │ > └─────────┴───────────────────────────┘ > > I know this is probably a trivial problem, but I am stumped. > > what am I doing wrong? > > thanks, > > Ken > > > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm