Now it works great, thanks Allin!
I completely agree with John that the gretl frontend to gnuplot was... ahem, *is* very
nice. But many times when I tried to get a non-standard graph by editing the gnuplot
commands I failed, and looking at the gnuplot documentation didn't help much. Also it
seems to me that R's demo graphics tend to look more polished or "modern"
than the gnuplot outputs. So I'm willing to give R a shot, maybe it's easier to
learn and/or better documented. And since there seems to be a general trend towards R, the
payoff may be double: getting the graphics and at the same time slowly learning how to use
it for the part of econometrics which isn't yet implemented in gretl.
Anyway, I'm sure gnuplot and R will coexist for a long time, but I think that gretl
also has great potential as a data manager and GUI frontend to R.
Thanks for that feature and for your help,
Sven
-------- Original-Nachricht --------
Datum: Tue, 5 Aug 2008 10:03:51 -0400 (EDT)
Von: Allin Cottrell <cottrell(a)wfu.edu>
An: Gretl list <gretl-users(a)lists.wfu.edu>
Betreff: Re: [Gretl-users] graphs with R from within gretl?
On Mon, 4 Aug 2008, John C Frain wrote:
> I have the same problem when I try to run the script from R.
> Like Allin I can not see what is wrong...
Th scoop is that
(a) the postscript() function lives in the grDevices package, not
graphics; and
(b) grDevices is among the standard packages loaded by R by
default, but this doesn't happen until _after_ the init file
(RPROFILE) has been processed.
The mechanism used by gretl for starting R is: write a suitable
ad hoc init file; set the RPROFILE variable so this init file is
read; and, at the end of the init file, "source()" any specific
commands. So those commands get executed before the standard
packages are loaded.
There are 3 possible fixes:
1. Insert "require(grDevices)" before calling postscript().
2. Call the function as grDevices::postscript()
3. Change gretl's R-startup, so that instead of using source() for
the user-specific commands we call "R -f" with the name of the
file containing the commands. In this way, the standard packages
will get loaded before the user-commands are executed. This is a
general solution, but only for non-interactive use.
Allin.
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users