# Divide cells in column by the column's mean

Good morning,

I was wondering how to divide cells in columns by the column’s mean. The input is a pivot.

e.g.

Existing pivot table:

``````     A1    A2    A3
``````

N1 1 2 3
N2 3 1 4

Needed solution:

``````      A1      A2      A3
``````

N1 1/4 2/3 3/7
N2 3/4 1/3 4/7

I probably need to use the Math node, but I don’t know how to configure it.

Cheers,
Manuel

Well the format changed when posting it.
Cells first table:

N1/A1 1
N1/A2 2
N1/A3 3
N2/A1 3
N2/A2 1
N2/A3 4

Cells output table:

N1/A1 1/4
N1/A2 2/3
N1/A3 3/7
N2/A1 3/4
N2/A2 1/3
N2/A3 4/7

Hope it makes sense.

Hi @hoppel77 -

Here’s the solution I came up with. You can either use a series of Math Formula nodes, or you can get a little more clever and use a single Math Formula (Multi Column) node.

MathFormulaNodeExample.knwf (10.4 KB)

Does this help?

Use group by firs for An field then join new table back to the original one by An field and finally divide An by new column.

I need to use the Math Formula (Multi Column) node since there is more than 38,000 columns.
Knime tells me to install the KNIME Math Expression JEP, but even after installing it (or better: it seems like it was installed already) the node in your workflow does not work.

Status: Error: Node “Math Formula (Multi Column)” not available from extension “KNIME Math Expression (JEP)” (provided by “KNIME AG, Zurich, Switzerland”; plugin “org.knime.ext.jep” is installed)

Any suggestions?

Under File --> Install KNIME Extensions, have you already installed Source for KNIME Math Expression (JEP)?

Yes the source is also installed. I have no idea why it is not working.

If I want to open the workflow KNIME tells me to install the Math Expression over and over again.
Is there 2 kinds of licences maybe?

Cannot complete the request. See the error log for details.
“Source for KNIME Math Expression (JEP)” will be ignored because it is already installed.

That’s the error.

Do you have a KNIME log file you could attach? You’re at least the second person I know of that’s having a problem using this particular node. Maybe that will help get at the heart of the issue.

2018-03-28 17:41:26,779 : DEBUG : ModalContext : FileWorkflowPersistor : MathFormulaNodeExample : 0 : Unable to load node with ID suffix 4 into workflow, skipping it: Node “Math Formula (Multi Column)” not available from extension “KNIME Math Expression (JEP)” (provided by “KNIME AG, Zurich, Switzerland”; plugin “org.knime.ext.jep” is installed)
org.knime.core.node.workflow.WorkflowPersistor\$NodeFactoryUnknownException: Node “Math Formula (Multi Column)” not available from extension “KNIME Math Expression (JEP)” (provided by “KNIME AG, Zurich, Switzerland”; plugin “org.knime.ext.jep” is installed)
Caused by: java.lang.ClassNotFoundException: org.knime.ext.jep.multicolumn.MultiColumnJEPNodeFactory cannot be found by org.knime.core_3.4.3.v201802091246
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.knime.core.eclipseUtil.GlobalClassCreator.createClass(GlobalClassCreator.java:144)
… 9 more
2018-03-28 17:41:26,785 : DEBUG : ModalContext : JEPNodeFactory : MathFormulaNodeExample : 0 : Factory is already initialized. Nothing to do.
2018-03-28 17:41:26,786 : DEBUG : ModalContext : JEPNodeFactory : MathFormulaNodeExample : 0 : Factory is already initialized. Nothing to do.
2018-03-28 17:41:26,789 : DEBUG : ModalContext : WorkflowManager : : : Added new connection from node 0:1(1) to node 0:3(1)
2018-03-28 17:41:26,789 : DEBUG : ModalContext : WorkflowManager : : : Added new connection from node 0:5(1) to node 0:6(1)
2018-03-28 17:41:26,789 : DEBUG : ModalContext : WorkflowManager : : : Added new connection from node 0:1(1) to node 0:4(1)
2018-03-28 17:41:26,789 : DEBUG : ModalContext : WorkflowManager : : : Added new connection from node 0:3(1) to node 0:5(1)
2018-03-28 17:41:26,853 : DEBUG : ModalContext : Math Formula : Math Formula : 0:3 : Configure succeeded. (Math Formula)
2018-03-28 17:41:26,854 : WARN : ModalContext : MISSING Math Formula (Multi Column) : MISSING Math Formula (Multi Column) : 0:4 : Node can’t be executed - Node “Math Formula (Multi Column)” not available from extension “KNIME Math Expression (JEP)” (provided by “KNIME AG, Zurich, Switzerland”; plugin “org.knime.ext.jep” is installed)
2018-03-28 17:41:26,856 : DEBUG : ModalContext : Math Formula : Math Formula : 0:5 : Configure succeeded. (Math Formula)
2018-03-28 17:41:26,856 : DEBUG : ModalContext : Math Formula : Math Formula : 0:6 : Configure succeeded. (Math Formula)
2018-03-28 17:41:26,858 : DEBUG : ModalContext : WorkflowManager : : : Loaded workflow from “/home/manuel/knime-workspace/MathFormulaNodeExample” with errors
2018-03-28 17:41:26,859 : ERROR : ModalContext : LoadWorkflowRunnable : : : Errors during load: Status: Error: MathFormulaNodeExample 0 loaded with errors
2018-03-28 17:41:26,859 : ERROR : ModalContext : LoadWorkflowRunnable : : : Status: Error: MathFormulaNodeExample 0
2018-03-28 17:41:26,859 : ERROR : ModalContext : LoadWorkflowRunnable : : : Status: Error: Node “Math Formula (Multi Column)” not available from extension “KNIME Math Expression (JEP)” (provided by “KNIME AG, Zurich, Switzerland”; plugin “org.knime.ext.jep” is installed)
2018-03-28 17:41:28,525 : DEBUG : main : ProjectWorkflowMap : : : Adding “file:/home/manuel/knime-workspace/MathFormulaNodeExample/” to project map (1 in total)
2018-03-28 17:41:28,536 : DEBUG : main : ProjectWorkflowMap : : : registering org.knime.workbench.editor2.WorkflowEditor@336f70a6 to file:/home/manuel/knime-workspace/MathFormulaNodeExample/. 1 registered clients now.
2018-03-28 17:41:28,622 : DEBUG : main : WorkflowRootEditPart : : : part: NodeAnnotationEditPart( )
2018-03-28 17:41:28,647 : WARN : main : FontStore : : : Using the system default font for annotations: Font {139963660778784}
2018-03-28 17:41:28,653 : DEBUG : main : WorkflowRootEditPart : : : part: NodeAnnotationEditPart( )
2018-03-28 17:41:28,654 : DEBUG : main : WorkflowRootEditPart : : : part: NodeAnnotationEditPart( )
2018-03-28 17:41:28,654 : DEBUG : main : WorkflowRootEditPart : : : part: NodeAnnotationEditPart( )
2018-03-28 17:41:28,654 : DEBUG : main : WorkflowRootEditPart : : : part: NodeAnnotationEditPart( )
2018-03-28 17:41:28,658 : DEBUG : main : WorkflowRootEditPart : : : part: NodeContainerEditPart( Table Creator 0:1 (EXECUTED) )
2018-03-28 17:41:28,700 : DEBUG : main : ConnectionContainerEditPart : : : refreshing visuals for: STD[0:1(1) -> 0:3( 1)]
2018-03-28 17:41:28,700 : DEBUG : main : ConnectionContainerEditPart : : : modelling info: null
2018-03-28 17:41:28,703 : DEBUG : main : ConnectionContainerEditPart : : : refreshing visuals for: STD[0:1(1) -> 0:4( 1)]
2018-03-28 17:41:28,703 : DEBUG : main : ConnectionContainerEditPart : : : modelling info: null
2018-03-28 17:41:28,703 : DEBUG : main : WorkflowRootEditPart : : : part: NodeContainerEditPart( Math Formula 0:3 (CONFIGURED) )
2018-03-28 17:41:28,704 : DEBUG : main : ConnectionContainerEditPart : : : refreshing visuals for: STD[0:1(1) -> 0:3( 1)]
2018-03-28 17:41:28,704 : DEBUG : main : ConnectionContainerEditPart : : : modelling info: null
2018-03-28 17:41:28,705 : DEBUG : main : ConnectionContainerEditPart : : : refreshing visuals for: STD[0:3(1) -> 0:5( 1)]
2018-03-28 17:41:28,705 : DEBUG : main : ConnectionContainerEditPart : : : modelling info: null
2018-03-28 17:41:28,705 : DEBUG : main : WorkflowRootEditPart : : : part: NodeContainerEditPart( MISSING Math Formula (Multi Column) 0:4 (IDLE) )
2018-03-28 17:41:28,705 : DEBUG : main : ConnectionContainerEditPart : : : refreshing visuals for: STD[0:1(1) -> 0:4( 1)]
2018-03-28 17:41:28,705 : DEBUG : main : ConnectionContainerEditPart : : : modelling info: null
2018-03-28 17:41:28,706 : DEBUG : main : WorkflowRootEditPart : : : part: NodeContainerEditPart( Math Formula 0:5 (CONFIGURED) )
2018-03-28 17:41:28,706 : DEBUG : main : ConnectionContainerEditPart : : : refreshing visuals for: STD[0:3(1) -> 0:5( 1)]
2018-03-28 17:41:28,706 : DEBUG : main : ConnectionContainerEditPart : : : modelling info: null
2018-03-28 17:41:28,707 : DEBUG : main : ConnectionContainerEditPart : : : refreshing visuals for: STD[0:5(1) -> 0:6( 1)]
2018-03-28 17:41:28,707 : DEBUG : main : ConnectionContainerEditPart : : : modelling info: null
2018-03-28 17:41:28,707 : DEBUG : main : WorkflowRootEditPart : : : part: NodeContainerEditPart( Math Formula 0:6 (CONFIGURED) )
2018-03-28 17:41:28,708 : DEBUG : main : ConnectionContainerEditPart : : : refreshing visuals for: STD[0:5(1) -> 0:6( 1)]
2018-03-28 17:41:28,708 : DEBUG : main : ConnectionContainerEditPart : : : modelling info: null
2018-03-28 17:41:50,638 : DEBUG : main : NodeContainerEditPart : : : Math Formula 0:6 (CONFIGURED)
2018-03-28 17:41:50,638 : DEBUG : main : NodeContainerEditPart : : : MISSING Math Formula (Multi Column) 0:4 (IDLE)
2018-03-28 17:41:52,345 : DEBUG : Service Thread : MemoryAlertSystem : : : Memory usage below threshold of 0.86875 after GC run

Not sure how to attach and what to attach. Is this part the one you were looking for?

Thanks! Let me ping one of our devs for some help and I’ll get back to you.

Alright, thank you!

UPDATE: The Math Formula (Multi Column) node is newly available to version 3.5. So you’ll need to update your version of KNIME Analytics Platform to use it. Sorry for the confusion!

Thank you for your help! I’ll update it.