Problems with remote R Snippets

Dear KNIMErs,

I have a very strange problem with remote R Snippets in KNIME (using KNIME in windows and sending the work packages to Rserve running under Linux).

The following code works both in a local and in a remote R Snippet:

a<-"foo"
b<-"bar"
R<-paste(a,b)

Result:
[1] "foo bar"

The following code works only in local R Snippets:

a<-"foo"
b<-"bar"
R<-c(a,b)

Result:
[1] "foo" "bar"

However, the remote Snippet returns (in Console):

Quote:
ERROR R Snippet (Remote) Execute failed

:shock:

Can anybody help me with this?

Many Thanks,

Phil.

P.S.: I just tried using a local "remote" Rserve (starting Rserve() in a local R window in Windows after downloading the library). The results are the same as above, first example works, second example doesn't).

Hi! Sorry, I can't reproduce the problem, can you please change the console log level to DEBUG in the KNIME Preferences and send me the stack trace you get, when you execute the R Snippet (Remote) node. For me, both cases and scripts work fine; I am running KNIME 1.3.5 with R 2.5.0 and Rserve 2.4.0. Cheers, Thomas

Hello,

thanks for the help.

Does this help you with my error?

Cheers,
Phil.

DEBUG	 RConsoleModel	 voidEval: try(a<-"foo")
DEBUG	 RConsoleModel	 voidEval: try(b<-"bar")
DEBUG	 RConsoleModel	 voidEval: try(R<-c(a,b))
DEBUG	 RConsoleModel	 R: org.rosuda.REngine.REXPGenericVector@1af4abb[2] class org.rosuda.REngine.REXPGenericVector
ERROR	 R Snippet (Remote)	 Execute failed
DEBUG	 R Snippet (Remote)	 Execute failed
java.lang.NullPointerException
	at org.knime.ext.r.node.RConsoleModel.readList(RConsoleModel.java:190)
	at org.knime.ext.r.node.RConsoleModel.execute(RConsoleModel.java:116)
	at org.knime.core.node.NodeModel.executeModel(NodeModel.java:441)
	at org.knime.core.node.Node.execute(Node.java:991)
	at org.knime.core.node.workflow.NodeContainer$1.run(NodeContainer.java:1193)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
	at java.util.concurrent.FutureTask.run(FutureTask.java:123)
	at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:126)
INFO 	 R Snippet (Remote)	 reset
DEBUG	 WorkflowEditor	 Workflow event triggered: WorkflowEvent [type=NodeConfigured;old=null;new=null;timestamp=Jul 7, 2008 3:42:51 PM]
DEBUG	 WorkflowRootEditPart	 WorkflowRoot: workflow changed, refreshing children/connections..
DEBUG	 WorkflowEditor	 Workflow event triggered: WorkflowEvent [type=NodeFinished;old=R Snippet (Remote)(#3);new=R Snippet (Remote)(#3);timestamp=Jul 7, 2008 3:42:51 PM]
DEBUG	 WorkflowRootEditPart	 WorkflowRoot: workflow changed, refreshing children/connections..
DEBUG	 WorkflowManager	 Workflow execution time: 172 ms

Hi,
Did anyone come up with a solution for this? I am having the same problem, where a script works on local R but not in remote R.
Thanks, Liz

Hi Liz, Hi mixmaxx,
I am not able to reproduce this behavior using KNIME 2.1.2 together with R version 2.7.2 - I started Rserve() and the following script executes successfully:
a<-"foo"
b<-"bla"
R<-c(a,b)

resulting in on column with two rows containing “foo” and “bla”.

Cheers, Thomas

Hi Thomas,

I think I have worked out where the R Remote Server snippet is breaking. In the code below, R contains a table in the format . I am trying to split the list of numbers and get the log of the median for each row:

dataMatrix <- data.frame(R[1:10,])
dataMatrix$new <- as.vector(dataMatrix[,2])
for (i in 1:10)
{
dataMatrix[i,4] <- log(median(sapply(unlist(strsplit(dataMatrix[i,3],", ")), as.numeric)))
}
R <- dataMatrix[,c(1,4)]

This code runs fine in the local R snippet but fails in the remote R. When I comment out the loop then the code completes in remote R. Any ideas why the loop is making it fail?

Thanks,
Liz

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