Chris Pelkie's suggested use of Lookup after CategoryStatistics does exactly 
what I need.  I hadn't realized how powerful Lookup is.

Thank you very much Chris.

Susan Schwarz
Research Computing
Dartmouth College





--- Chris Pelkie wrote:
Try this. Add Lookup after CategoryStatistics (in the sample categorical.net).
Connect CategoryStatistics->Lookup ("input") and ImportSpreadsheet ("data"
output) -> Lookup ("table"). Open Lookup, Expand to see the hidden tabs,
and edit as follows:
Input Name        Value
data              "data"
lookup            "income"
value             "customer"
destination       "lookedup"

Print("rd") the output of Lookup. You should see the customer number
corresponding to each of the 4 states' max incomes. Why? Lookup used the
"data" in the CategoryStatistics output field as the values it was looking
up in the "income" component array of the original input field (where all
possible incomes reside). Since both "income" and "customer" arrays are
dependent (i.e., to be found in the same order) on "positions", finding the
"position" index of a value in the "income" array tells you the index into
the "customer" array where you'll find the customer id number (again, in
the original input). So you use CategoryStatistics to find the 4 values out
of the complete input data set of max "income", then you Lookup the
corresponding 4 values of "customer" by the shared positional index (which,
by the way, never actually appears anywhere).

There is a proviso: Lookup stops on the first successful match. Be aware
that if you had more than one gene that has the max value, you will only
see the first hit in the output. You might want to run "count" against your
value component to see if the max value has more than one occurrence, then
do something appropriate. THAT exercise is left to the reader. Or, that's
where I start getting consulting fees...

You can change "lookedup" to some other name (including one you make up, or
to "data"). That is the component in the output field that gets the results
of Lookup. The other names are specific to the fields you are feeding in:
so in this case, they are quite specific.

BTW, I've used Lookup for years and I ALWAYS have to lookup the meaning of
the inputs. (:-)
--- end of quote ---

Reply via email to