Grokbase Groups R r-help March 2002
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)[2],
dim(x)[1]*dim(x)[3]) 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

r-help mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupr-help @
postedMar 13, '02 at 10:57a
activeMar 13, '02 at 11:04a

2 users in discussion

Agustin Lobo: 1 post Martin Maechler: 1 post



site design / logo © 2018 Grokbase