Skip to content
Back to formatted view

Raw Message

Message-ID: <200106290457.QAA09642@aqua.mcs.vuw.ac.nz>
Date: 2001-06-29T04:57:02Z
From: Ray Brownrigg
Subject: RJava: getting mean() of Integers[]

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