On Mon, 2 Jan 2017, Jan Tille wrote:
Dear Gretl users,
wishing you all a Happy New Year 2017.
Unfortunately I am encountering a problem when trying to interact with
R, i.e. passing data back and forth.
I am using a tiny test script to make myself familiar with the
interaction. This is more or less a copy-past version of the user
manual's example (36.1)
mwrite(funds,"funds.mat",1)
foreign language=R --send-data --quiet
funds1<-gretl.loadmat("funds.mat")
gretl.export(funds1,"funds12")
end foreign
matrix funds1={}
funds1 = mread("funds12.mat",1)
Gretl writes the matrix properly into the dotdir and passes it to R. The
matrix, which is unaltered is saved in my dotdir as well, though
somewhat larger (3.9 MB vs. 2.2 MB).
However, when I try to import that matrix from the dotdir I always get
an error message.
I have no clue why this happens, because I just rename an existing
matrix.
The problem is the --send-data option. You use that to send your dataset
to R under the name "gretldata", but you are probably running your script
with no dataset open, so gretl gets confused. If you either (a) open an
empty datased via "nulldata 10" or something similar or (b) get rid of
--send-data in the "foreign" command, everything should be ok.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------