I'm trying to export an R (1.4.0 on linux) matrix to python
(+Pyclimate) via a binary file. The problem is
that while R writes by columns, python reads
by rows. For a 2D matrix, there is no problem:
writeBin writes vectors, so
writeBin(t(x)[1:length(x)],...) works fine.
But the objects I want to export are 3D arrays
(slice rasters of lat,lon for each time t).
One way is to use a loop over the
3rd dimension and transpose for each slice, but I've
been trying to do something more efficient avoiding the
loop. No luck by now, as changing dim(x) to c(dim(x),
dim(x)*dim(x)) does not solve the problem.
Does anybody have any suggestion?
Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es
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