It's easy enough to load scalers and simple arrays into R through Statistics::R but I'm having trouble with multidimensional arrays. The manual doesn't actually claim to support this but maybe someone has managed.
Arrays are passed to R by reference (to make a simple list in R). Passing a reference to a multidimensional array produces a list of array tags. For example:
produces:use Statistics::R; use Data::Dumper; my @arr = qw(foo bar baz); my @mat = (["fred", "barney", "pebbles", "bambam"], ["george", "jane", "elroy", "judy"], ["homer", "bart", "marge", "maggie"]); my $R = Statistics::R->new(); $R->set('arr', \@arr); $R->set('mat', \@mat); my $r_arr = $R->get('arr'); my $r_mat = $R->get('mat'); print "Array:\n", Dumper($r_arr); print "Matrix:\n", Dumper($r_mat);
Array: $VAR1 = [ 'foo', 'bar', 'baz' ]; Matrix: $VAR1 = [ 'ARRAY(0x7fdbf4007328)', 'ARRAY(0x7fdbf4014b80)', 'ARRAY(0x7fdbf4014c58)' ];
In reply to multidimensional array in Statistics::R by igelkott
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |