Feeding Knime data output into RStudio

Hi Knime experts,

I have a problem with which I hope to find help here. I am relatively new to Knime as well as R but I have started to learn how to use these Programs. I want to process primary data in excel sheets (stemming from a mouse tracking software) in Knime to get a combined table containing all the filtered data, which I then want to plot using ggplot2 in R.
I successfully made a Knime workflow which gives me the desired table, and I managed to install Rstudio including Rserve and other required packages (by the way, I am using Windows 10). I also managed to set up R in a way which allows me to successfully plot my data using the “R Plot” node and the R script templates there provided.
Now I found myself unsatisfied with the results and thus I want to change the R script in order to customize my plots to my needs. I can do this within the “R Plot” node by clicking on “Edit template”, and I have succeeded at doing some changes mostly by using suggestions from people at stackoverflow, as I am a total beginner at R programming. Theoretically I am making progress and all is ok, BUT working in that script editor provided within the “R Plot” node is a pain in the neck.

Rather, I want to convert my output into an R table (or whatever that is called) and feed it directly into RStudio, where I want to access said table by scripts on which I work therein.

But if I use the “Open in R” node (both the Generic one and the community node made by people at the Max-Planck-Institute), I get an error message:

“ERROR Open in R 0:79 Execute failed: Failed to open in R
Cannot run program “C:\Program”: CreateProcess error=2, Das System kann die angegebene Datei nicht finden”
(the last part is German for “The system cannot find the file”)

What could be the problem here?

Best
Quirin

PS: I had followed all steps described at [Install R alongside KNIME on Windows and MacOS] by mlauber71, though I found I was unable to install the “latest” version of RServe in Rstudio by means of " install.packages('Rserve',,"http://rforge.net/",type="source")", which gave the following error:

"

C:/Program Files/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG -DRSERVE_PKG -DWin32 -I. -Iinclude -Iinclude/Win32 -O2 -Wall -std=gnu99 -mtune=generic -c RSserver.c -o RSserver.o
sh: C:/Program: No such file or directory
make: *** [C:/PROGRA~1/R/R-36~1.0/etc/x64/Makeconf:208: RSserver.o] Error 127
ERROR: compilation failed for package ‘Rserve’

  • removing ‘C:/Users/LAB/OneDrive/Dokumente/R/win-library/3.6/Rserve’
  • restoring previous ‘C:/Users/LAB/OneDrive/Dokumente/R/win-library/3.6/Rserve’
    Warning in install.packages :
    installation of package ‘C:/Users/LAB/AppData/Local/Temp/RtmpOUyHoU/downloaded_packages/Rserve_1.8-6.tar.gz’ had non-zero exit status"
    "

Here it reverts to the RServe installation which I installed in RStudio via “Tools → Install Packages”, but this apparently is version 1.7-3.1 instead of the newest 1.8-6 which mlauber71 recommends.

You could toy around with R and KNIME exports either using the generic KNIME ports or just export from inside the R nodes into graphic files, CSV files, .RDS r files, or whole environments .rdata.

Later you could import these files right into RStudio. With .rdata you might save a whole workspace with all results and bring it back into RStudio.

Attached you find some examples:

kn_example_r_export_data_rdata.knar (275.3 KB)

With regards to RServe 1.8.6 - you will have to compile it seemingly. I tried to address several ways to do that in the article you mentioned. You might have to continue trying and see if any one of the ways might help you.

1 Like

Dear mlauber71,
thanks a lot for your response!

Thank you for pointing this out. I now just used the “Table to R” node similar as in the example workflow you uploaded, and then loaded the resulting file into R. (Being new to the world of programming and Knime, I admittedly do not yet understand most of the additional steps you used there, but I will study them and try to see what they all do)

This is a decent workaround and enabled me to work on the KNIME-transformed data in RStudio. Ideally I would like to have a direct link between KNIME and RStudio as I mentioned, but at least it works.

Re-installing RTools 3.5 helped: Install directory has to be C:\RTools (not in C:\Program Files\RTools) and the box that allows Rtools to modify system PATH has to be checked (I had not done that before).
Now I have successfully compiled RServe 1.8.6 (shows up under “Packages” in RStudio). When I start an R Server with “library(Rserve); Rserve(args = “–vanilla --RS-enable-remote”);”, it appears in the process explorer of Windows.

However, when trying to use the KNIME node “Open in R”, I still get the same error message as before…

Any idea?

1 Like

As mentioned in the article there are two basic groups of R nodes in KINME one “official” and one from the community. The official nodes would just start R in the background whenever necessary the other ones expect the —vanilla sever thing to already be up and running in the back. Be sure to not mix that up, it might or might not work otherwise.

Open in R I would assume would try to open in the basic R not RStudio (not sure if you could combine that with external tools though).

Maybe you could try again and post the error message and maybe even the log file. That might give us further ideas.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.