# Percent of an event

Dear's

I do not find how to to that :

From a file that contain :

Col1    Col2

X          X

x          A

x          A

A           X

how to obtain the percent of X, along the row :

Col1   Col1-%   Col2   Col2-%

x           100        x        100

x           100        A          50

x            100       A          33

A            75         x          50

Many, many thanks in advance for helping

Mitch

Try the column aggregator node, is it maybe what you need.

Simon.

Hi richard,

I do not find the solution with column aggr.

Let's try with only one column :

Col1
X
X
A
A
X
how to obtain the percent of X, along the row :
Col1   Col1-%

X           100         1 time in 1 event
X           100         2 time in 2 event
A           66           2 time   in 3 event
A           50           2 time  in 4 event
X           60           3 time  in 5 event

It means....what is the percentage the event X appears, mesured for each event (row)

Hm I don't fully get it... You are talking about columns, but the aggregation is only over rows?

In your second example: In line 3 it was the first time A showed up. Why is it 2 times in 3 events?

In your first example: Are both columns one set? Why is the value of the third row in col2 33? shouldn't it be 66? And the fourth row in col1 why is it 75, I would have thought it is 25?

I will attach you a workflow which solves the problem... at least in the way I understood it.

Hope it helps,

Iris

I think I now understand. You are counting te percentage of x after each row. So down the column.

my quick thoughts are that it's not easy. I would first use the one2many node to get a count of 0 or 1 in an an X column. You would then need to generate a row index using the maths formula node (row index+1).

now the tricky part is accumulating the values in the x column. You will need to do this using the delegating loop start And end nodes, but these are nodes that need some good knime understanding.

finally you would take your accumulated values and divide by the row index column multiplied by 100.

simon

Hi iris, richard,