R problems on the KNIME Server

Hey everyone!

I am trying to save a png file in a folder on the KNIME server using R.

This is the code that I am running for a local folder:

library(png)

save_png <- function(plot, path){
DiagrammeRsvg::export_svg(plot) %>%
charToRaw() %>%
rsvg::rsvg() %>%
png::writePNG(path)
}

save_png(picture, "C:/Users/test/Visualizations/finalPicture.png")

The code above works and saves the picture I need in a local folder. But when I replace the path relative to the KNIME server. For example,

knime://knime-server/Users/tests/project1/data/finalPicture.png

It fails and gives me the following error:

The following object is masked from 'package:stats':

   filter

The following object is masked from 'package:utils':

   timestamp

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

   filter, lag

The following objects are masked from 'package:base':

   intersect, setdiff, setequal, union

Linking to librsvg 2.48.8
Error: unable to create knime://knime-server/Users/tests/project1/data/finalPicture.png

It would be great if someone could resolve this for me. At the beginning of the script, the necessary packages are being installed using install.packages(…). So I think the packages are all installed on the server.

Thank you!

@RijinM I think you will have to provide an absolute path that works on the KNIME server since R will not be able to understand KNIME paths.

But you could create dynamic relative paths and try to store the data from within the R node.

Or you could bring the graphic back to KNIME and just sore it with an image writer.

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