R Snippet error when reading knime:// protocol

hi all,

I tried to read and write several .csv files from R snippet and use relative path to set the location of the files.

write.table(knime.in, file="knime://knime.workflow/../01_Backup/TrainingSet_DS3.csv")

however, I always received and error message: Execute failed: Error in R code: "Error: cannot open the connection"

I also tried to use the knime.workspace variable and it works locally but not in the server.

write.table(knime.in, file=paste0(knime.flow.in[["knime.workspace"]], "/Test/01_Backup/TrainingSet_DS3.csv"), sep = ",")

anyone knows what is happening and how to use relative path in R Snippet?

Hi pkusuma, 

In order to be able to set location from withing an R Snippet node, you need an absolute path. To get it you can use an Explorer Browser node, which allows to get absolute path of target location as a flow variable. 

Please find attached a sample workflow.  

 

Best,

Anna

Yes, it works!

Thanks, Anna