I am quite new to Knime and was wondering if someone could help me out. I am having trouble getting a nested loop working. Below is a basic description of what I am trying to achieve.
I have an excel document with 50 columns and 100 rows. I am attempting to create a workflow that randomly samples 50 out of the 100 rows for each column, 1000 times(placing each of the 1000 iterations next to each other), then moves onto the next column and repeats. This would create an output of 1000*50 columns with a fixed size of 50 rows due to the sample amount.
I am planning to use a column list loop to iterate through each of the 50 columns, and a counting loop set to 50 in order to get 1000 row sample iterations.
I've attached a screenshot of my current workflow. The error I am getting is
Loop End (Column Append) 0:11 Loop end already assigned (start node has more than one end node)
Thanks in advance!
as you are writing you are creating a nested loop. Hence, you have to finish the Counting Loop within the Column List Loop for things to work (i.e. put the "Loop End (Column Append)" node after the "Transpose" node and after that add the "Loop End" node). If your data should be 50000 columns and 50 rows at the end of your workflow, you need to use a second "Loop End (Column Append)" node instead of the "Loop End" node and some renaming might be required/helpful.
Hope this helps!
Thanks for the advice, I've given it a go and it's worked. I do have some new problems that arose which I didn't account for before, but that's a different issue.
After updating the workflow, it is now working. However, because I am sampling 50 out of 100 at random, each column has different row chosen. This results in numerous empty cells (in the screenshot). Is there a way to remove these empty cells ? I can't seem to find a node for this purpose.
I would like cells marked with ? deleted, with all cells in that column underneath the ? shifted upwards.
Apologies if this is unclear.
you can use the "RowID" node to solve this problem. Add the node before the end of your inner loop and configure it to create new row ids - it will automatically start from Row0 so that each sample you draw will have row ids 0-99 and the loop end will append the data accordingly.
Hope this helps,