From simon.urbanek at r-project.org  Fri Mar 18 20:48:06 2011
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Fri, 18 Mar 2011 15:48:06 -0400
Subject: [Rd] passing a 2D array from Java to R
In-Reply-To: <1300470724415-3387933.post@n4.nabble.com>
References: <1300470724415-3387933.post@n4.nabble.com>
Message-ID: <806F4C35-090C-448A-96CA-A1D3BD4CD5FE@r-project.org>

On Mar 18, 2011, at 1:52 PM, jcg3441 wrote:

> I have a 2D array of type double in java and I want to pass this data to R
> in order to compute some statistics. Can anyone help me with this ? 
> 

The best place would be the appropriate mailing list of the package that use use for R/Java communication. If it's rJava then stats-rosuda-devel mailing is the list to ask.

In R matrices are vectors of the length m*n so you can either create one array with the values in Java, assign it (let's say to A) and call matrix(A,m,n) or you can simply pull the array as-is to R and run something like sapply(a,.jevalArray).

Cheers,
Simon



[Rd] passing a 2D array from Java to R
Simon Urbanek