R snippet

We would like to run an R script in Knime using Flow Variables. See example [1].
Guess the workflow is correct, but the parameter settings are still unclear to me. Is there a tutorial?
Thanks

Lars

[1] https://www.dropbox.com/sh/uynuafb5t7xrvrt/AACoE1syvD18dl8XGtCbQVNna?dl=1

mzTab2R_20180608.knwf (10.2 KB)

Hi @lars20070 -

I took a look at your workflow. Although I don’t have your data to be able to fully execute it, maybe I can help.

Any flow variables passed into the R Snippet node should be visible in the Flow Variable List on the left-hand pane. Much like the usual data frame passed into the node, they are accessible via a data frame, in this case knime.flow.in. If you double click one of the flow variables, the GUI will show you the correct syntax.

Also, I think you will need a dummy table to feed into the R Snippet node. If I’m understanding your workflow correctly, you’re defining the file to be processed and passing its location via a workflow variable, but the R Snippet node still needs something ahead of it to execute, like so:

2018-06-08%2010_28_47-KNIME%20Analytics%20Platform

I’m not sure that we have explicit tutorials about using workflow variables with R Snippets, but we do have a few example workflows that demonstrate the R integration generally. For example: https://www.knime.com/nodeguide/scripting/r/example-of-r-snippet.

Does that help?

@ScottF Thank you for your very quick reply.

I introduced a new variable mzTabFile and added a dymmy table. The new workflow mzTab2R_20180611.knwf and an example input file Tescht.consensusXML you can find in the above Dropbox [1]. I still get an error. Any further changes needed?

WARN  Table Creator        2:14       Node created an empty data table.
WARN  R Snippet            2:10       Errors overwriting node settings with flow variables: Unable to parse "missing" (variable "mzTabFile") as boolean expression (settings parameter "sendRowNames")
WARN  R Snippet            2:10       Errors overwriting node settings with flow variables: Unable to parse "missing" (variable "mzTabFile") as boolean expression (settings parameter "sendRowNames")

mzTab2R_20180611.knwf (12.1 KB)

The attached workflow by @AlexanderFillbrunn solved the problem. Thanks for the good support.

mzTab2R_20180608_AF.knwf (11.9 KB)

3 Likes