I have 20 parameters. Each parameter is measured for 2010 and for 2011, so 40 columns in all. I would like to compare each pair. How can I do that [other than by using 20 math formula nodes]?
Henk
I have 20 parameters. Each parameter is measured for 2010 and for 2011, so 40 columns in all. I would like to compare each pair. How can I do that [other than by using 20 math formula nodes]?
Henk
Not easy, this where an improved Maths node would come in which I've asked for a few times. What you could do is;
1. Take the data set, and use a column splitter node to separate 2010 and 2011 columns. Use an extract column header node, then from the top out port, use a transpose node on each which just contains the columnn Headers, and join them back together with a joiner node chosing to join by rowid.
2. You should now have two columns with all the column titles side by side for 2010 and 2011. Use a table row to variable loop start on this.
3. Now go back to the main data set (prior to step 1), and add a Column Filter node. Also connect the red variable line from Step 2 onto the top left of the column filter node. Now configure the column filter node by selecting the "Enforce inclusion" radio button and add any two columns, doesn't matter which ones. Now from the flow variables tab, expand the exclusion section, from the 0 dropdown choose Column Header, from the 1 dropdown choose Column Header (*). This will have the effect of selecting the 2010 and 2011 corresponding columns.
4. Now use another "extract column header" node. From the bottom port, connect a Maths node now to do the desired manipulation and specify a column name.
5. Now use two consecutive rule engine nodes, in each one choose the default label as "Column Header" for one, and "Column Header (*)" for the second one. Now use a Column Combiner on these two Prediction columns from the Rule Engine nodes. This will form the new column name.
6. Now add a Column Filter node and choose to only include the combined string column from the Column Combiner, and choose the Force Inclusion button. Now use a "table row to variable" node.
7. Prior to step 5, add a "Column Rename" node, and connect the red line from step 6 to this rename node at the top left. Configure this node, going to the flow variables tab. Find the column name from the Maths node output and from the dropdown choose the combined string variable which was created in step 6.
8. Now use a column filter node to remove the unneeded columns, choosing only the newly renamed to include, then choose Force Exclusion radio button. Now complete with a loop end column append node.
Not sure this is much quicker than 20 Maths nodes though, but at least its automated.
Simon.
Thanks Simon! It is good to see that at least there was not an easy way around this. I will try to solve it too via a snippet. In MATLAB or Python this sort of calculation is a piece of cake.
Henk