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

Ray Brownrigg Ray.Brownrigg at mcs.vuw.ac.nz
Fri Jun 29 06:57:02 CEST 2001

> 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)
How about something based on:
> mymean <- function(...){mean(c(...))}
> mymean(1,2,3,4)
[1] 2.5

Hope this helps,
Ray Brownrigg <ray at mcs.vuw.ac.nz>	http://www.mcs.vuw.ac.nz/~ray
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