As a newcomer to KNIME I do ask for help.
I want to sum up given numerical values of a column in a new column.
Example
iris-data new_column
4.4 4.4 |
4.4 8.8 |
4.5 13.3 |
I can't find a standard node to sum up the values in iris-data.
|
As a newcomer to KNIME I do ask for help.
I want to sum up given numerical values of a column in a new column.
Example
iris-data new_column
4.4 4.4 |
4.4 8.8 |
4.5 13.3 |
I can't find a standard node to sum up the values in iris-data.
|
You need the group by node.
It can be used for aggregations over all rows of a table grouping over the complete table. Hence, not using a group column.
In the second tab you can choose to get the sum over the iris-data column.
Cheers, Iris
Hi Iris,
I think that is not doing the expected thing. As I understood the original question was about running totals/partial sums. I agree that the GroupBy is closer to the answer than the column aggregation, but I think it is easier to solve with a Java snippet with something like:
double sum = 0;//should be among the fields ///... sum += c_col;//You might want to check for missing, NaN or infinite values out_column = sum;
Cheers, gabor
Actually there is a "Math formula" node in the "KNIME Math Expression (JEP)" extension which will do the job for you without need of any coding in Java.
Many thanks to everybody. Your comments are really helpful! I tried all your suggestions. Finally I used the 'Java Snippet' (simple) node, that worked out fine.
// Global Variable Declaration
Double sum = 0.0;
// Method Body
sum = sum + $iris-data$; //$iris-data$ is the 'data column'
return sum;
I checked the radio-button 'append a new column' .
I checked the radio-button return data-type 'double'.
Best regards, Alfred
Many thanks to Rosaria Silipo at www.dataminingreporting.com/2/post/2013/04/cumulative-sums-in-knime.html