[R] RJava: getting mean() of Integers[]

Vahid Pazirandeh vpaziran at yahoo.com
Thu Jun 28 23:12:06 CEST 2001


Hi,

how can i get the mean of some Integers[]?

i have R-1.2.3 and RJava installed (and working).  i
was wondering how to pass "vectors" as arguments to R
from Java?  an example may be the mean() function, as
it takes a vector of integers.

I can do:  mean(c(1,2,3,4))
I can _not_ do: mean(1,2,3,4)

as the latter is passing multiple arguments. 
furthermore, do perform the latter (which is incorrect
mind you) from java, i had setup the following code:


-- snip snip --
Integer[] numList = new Integer[4];
numList[0] = Integer.decode("1");
numList[1] = Integer.decode("2");
numList[2] = Integer.decode("3");
numList[3] = Integer.decode("4");
Object[] obj = (Object[])numList;
int[] object = (int[]) rEvaluator.call("mean", obj);
-- snip snip --


mind you i'm a new user to both these planets. :-)

regards,
vahid


=====
< NPACI Education Center on Computational Science and Engineering >
< http://edcenter.sdsu.edu >
=====

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list