I am applying an hypotesis test to a set of rows in a table. I need to split such rows by the value of a categorical variable, then conduct the test for each subset of my data.
I used a loop and was able to achieve this, but with one important drawback: collected rows into the End Loop Node don't allow me to see to which value of the grouping column the row is related.
Is there a way to append to the collected rows set a new column containing the value of the categorical variable I was conducting the test on in that iteration?
If you are using a variable in the loop, can you add in a Rule Engine node inside the loop, and set the default value to be this variable. You will now have a new column containing this categorical variable value.
(This option will not work with the 2.9 Rule Engine at least in the preview for community the default value is no longer present, you have to use a rule for that.)
The String Replacer though still can be used. (I have attached a workflow.)
Hmmm, thanks for that Gabor.
on that point, I would like the knime team to reconsider this reimplementation on the rule engine node as this feature was really useful to add in the variable to a new column.
if you cannot change the rule engine node back, can you add a new node called Variable to New Column.
This is still possible in the new node, but it has to be done slightly different than before.
I maybe missing something, but there already is a 'Variable To TableColumn' node which you can use for this purpose (to keep track of what the variable value was in each loop iteration)
You are quite right Dave. Totally forgot about that node, and one that will be used more often now you have rejigged my memory!
I'm actually trying to do the same as you did : apply a t-test to various groups, but I don't really know how to use a loop to do that. You said that you managed to do that. Can you please show me an example of workflow which does that? That would help me a lot!
We also added a Constant Value Column node which does this a bit more elegantly. It even has a variable override button for maximum user enjoyment.