Error in .jcall(goose, "V", "createAndBroadcastMatrix", rownames(x), colnames(x), :

25 views
Skip to first unread message

Vladimir

unread,
Aug 10, 2009, 11:41:33 AM8/10/09
to gaggle-discuss
bug or mm I doing something wrong?


> broadcast(matrix(1:6,2,3))
Error in .jcall(goose, "V", "createAndBroadcastMatrix", rownames(x),
colnames(x), :
method createAndBroadcastMatrix with signature ([DLjava/lang/String;)
V not found

> version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 9.0
year 2009
month 04
day 17
svn rev 48333
language R
version.string R version 2.9.0 (2009-04-17)


package ‘rJava’ version 0.6-3

‘gaggle’ version 1.12.0

java 6.11

> nameList = c ("VNG0101G", "VNG0177G", "VNG0286C")
> broadcast (nameList)

work fine

Thanks
Vlad

Christopher Bare

unread,
Aug 10, 2009, 12:12:15 PM8/10/09
to gaggle-...@googlegroups.com
Hi Vladimir,

That is a limitation... OK, I guess you can call it a bug. The R Goose
requires matrices to have both row names and column names, and it's
error feedback could be better. Try this:

> m = matrix(1:6,2,3)
> rownames(m) = c("foo", "bar")
> colnames(m) = c("blither", "blather", "bonk")
> m
blither blather bonk
foo 1 3 5
bar 2 4 6
> broadcast(m)

That should work. Another, closely related bug is illustrated here:

> m = matrix(1:6,1,6)
> m
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1 2 3 4 5 6
> rownames(m) = c("foo")
> colnames(m) = c("a", "b", "c", "d", "e","f")
> m
a b c d e f
foo 1 2 3 4 5 6
> broadcast(m)
Error in .jcall(goose, "V", "createAndBroadcastMatrix", rownames(x),
colnames(x), :
method createAndBroadcastMatrix with signature
(Ljava/lang/String;[Ljava/lang/String;[DLjava/lang/String;)V not found

Here the problem is a matrix with a single row. Either single-row or
single-column matrices will cause this error.

We have a simple fix for the second bug, and I think it would also be
easy to fix your example. We'll try to release a version of the R
Goose with these fixes shortly.


Potentially too much information:
-----------------------------------------------

We use the rJava library to call Java methods within R. The error
message you're seeing comes from rJava's function .jcall, which makes
its best guess when mapping from R data types to Java data types. Both
of these errors arise when rJava makes a bad guess. For instance, all
variables in R are vectors. Saying i=1 is shorthand for "i is a vector
of type integer of length 1". So, it's tricky to know when our R data
type should map to a Java array or a single object or primitive.

Notice the type signature in the second example above. It's looking
for a method with that looks like this:

void createAndBroadcastMatrix(String, String[], double[], String);

It can't find it because the real method looks like this:

void createAndBroadcastMatrix(String[], String[], double[], String);

So, it's simple enough for us to add in the missing method as a
special case. I imagine we can do the same for cases where rownames(m)
or colnames(m) is NULL.

Thanks for reporting this issue!

-Chris

------------------------------------------------
J. Christopher Bare
Software Engineer, Baliga Lab
Institute for Systems Biology
------------------------------------------------
Reply all
Reply to author
Forward
0 new messages