Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: multidimensional array in Statistics::R

by BrowserUk (Pope)
on Feb 07, 2013 at 14:03 UTC ( #1017657=note: print w/ replies, xml ) Need Help??


in reply to multidimensional array in Statistics::R

Looking at the docs, it seems like you'd have to set one vector of the multi-dimensional array at a time.

Something (untested) like this:

... $R->set("mat[$_]", $mat[$_] ) for 0 .. $#mat;

But you probably need to tell R that 'mat' is a matrix first by preceding the above with something like:

mat=matrix(1:12,3,4)

Or perhaps a data.frame with named columns would be a better choice. See the R docs.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: multidimensional array in Statistics::R
Select or Download Code
Replies are listed 'Best First'.
Re^2: multidimensional array in Statistics::R
by igelkott (Curate) on Feb 07, 2013 at 17:38 UTC

    I ended up splitting my data into individual vectors and then combining them in R. Yes, it'd be nice to load directly into a "data.frame" but it's not too much bother to do it on the R side.

    This whole thing was just because my data was so nicely packaged from the database (via fetchall_arrayref) and it seemed a shame to split it just to stitch it back together.

    Thanks. Good to see that it wasn't just some obvious thing I'd missed.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017657]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (14)
As of 2015-07-29 12:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls