Getting error while importing and using library in r snippet

Hi,

i am using a R - snippet where i am first loading a library package then using it in the next step
But i am getting the following error :
"Error in library (lpSolveAPI) : there is no package called ‘lpSolveAPI’

Execution halted"

but the same steps if i do from the R console directly, no error is coming
please help!!!

regards
neha

Hi neha,
You are probably using the embedded R package which is shipped with KNIME. This version does not include any additional R packages, those must be installed separately into you local installation. After this has been done, you need to link to this R installation within the KNIME preference page >> R.
Regards, Thomas

Hi Thomas,

Thanks for the quick response
I am not using embeded R, but a separate R installation that is there in my machine
I am also installing this additional package in my R installation and then trying to use it
If i use it from the R console it is working fine
but when i am connecting to the same R through my KNIME R snippet, then getting that error

regards,
Neha

Hi Neha,
did you also check the dialog tab “R binary” inside the R Snippet dialog, does it point to your local R installation?
Regards, Thomas

Hi Thomas,
Yes, my R binary points to the local R installation in my machine
and i am doing the following steps in the R snippet:

library(lpSolveAPI)

this line, which tries to load the library gives the error :" package lpSplveAPI not found". this error comes when executing through knime R - snippet . but the same works fine from R console.

This package is used for solving linear optimization problem.Does KNIME support this optimization operation using knime R snippet? or is it something like through KNIME we can do only the statistical operations of R and not the others?

Hi Neha,
I just downloaded the newest R version 2.10 together with you suggested package. I copied this package into my local R installation, opened the R Console and successfully loaded the package. The same works in KNIME when linking to R 2.10 using the following test-script:

library(lpSolveAPI)
R <- R

It’s important to change the path either in the global KNIME preference or in each R node dialog with the “R path” tab.

Sorry, I have no idea!
Thomas

Hi Thomas,

Thank you very much for the help
I tried the steps you mentioned above , it works now

regards,
Neha

Hi Thomas,

Dos this mean that KNIME will not work with older versions of R ?

I have the same problem, I'm using R 3.02

Thanks

Mark