I have a very sparse Perl matrix (array of arrays) where the values are undefequivalent to zeros. It has 10-1000 rows and up to 100 thousand columns. It looks like this:
$ARRAY1 = [
[
( undef ) x 1069,
1,
( undef ) x 47,
1,
( undef ) x 11,
2,
( undef ) x 50,
1,
( undef ) x 23,
1,
( undef ) x 6033,
...
],
[
...
],
...
]
... as I said - very meager.
I want to use this matrix in an R script (see previous post ). One way is to print the table in a file from Perl - one line per line and print it 0anytime we run undef.
But maybe there is a better, more compact way to convey this sparse matrix?
source
share