I have a workflow which I am running from a Windows batch file.
The workflow has an R Snippet which loads a few packages, however when running in batch mode, the workflow fails as soon as it comes across a function from one of the installed packages.
I have tried the following, with no success:
installing the packages from within the snippet, before calling them
set all packages to ‘require()’
manually installing the packages to the SYSTEM library as well as my personal library
restarting RServe from within RStudio
explicitly stating which package each function comes from, e.g. jsonlite::fromJSON
The snippet runs perfectly fine within RStudio and within the GUI.
One example is the first package function I call from lubridate::ymd
Batch command prompt shows: Execute failed: Error in R code: “Error: there is no package called ‘lubridate’”
I am out of ideas, and can’t find any in the existing forum posts
Any other suggestions?
As you can see, I check for and then install each package to a specified library location, and then read the package from the specified library location, literally telling R which folder to use each time.
Have you found a solution for this one? I have checked the log but it didn’t tell me much. At least to me
I assume you are using -workflowDir option? Can you try simplifying the R snippet in a way that it does not use function from this package nor any other in order to try to narrow down the problem? Is that possible in your workflow?
It doesn’t seem to matter which libraries I load - they all fail.
Unfortunately there is no easy way of doing what I want to do in R without loading libraries, and using the libraries in R is an essential feature.
I was using the workflowDir option, should the libraries be installed to the workflow directory in order for it to work? I assumed KNIME would access the default R folder set in preferences when loading in batch mode.
according to the log you don’t have the packages installed.
If you are sure that they are installed and accessible installed.packages() should be able to list them. Maybe it’s an option for you to write the output of installed.packages() to some file and double-check that the required libraries are installed.