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
------------------------------------------------