Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.44.0305081007110.18567-100000@gannet.stats>
Date: 2003-05-08T09:11:25Z
From: Brian Ripley
Subject: again troubles with lattice
In-Reply-To: <3537.030508@eimb.ru>

On Thu, 8 May 2003, Wladimir Eremeev wrote:

> Dear r-help community,
> 
>   Thank you for your previous answers!
>   
>   Now I have strange behaviour of the lattice library funcitons.
>   They do not draw graphics in the file when called from the script.
>   I created the script file, called, for example, "a.R", containing
>   the following

They do when called from a script running directly.  It's calling the 
script file from source() that gives the problem.

You haven't actually asked for anything to be plotted!  xyplot returns a
plottable object, which when *printed* is plotted.  Auto-printing works at
the top level in R, but not inside source.  You need to wrap your lattice
calls in print().

[...]

> I execute command source("a.R") it works and after its running I've
> got file a.png in the working directory. But it contains only white
> background field and no graphs.
> 
> If I try copy commands of the script in clipboard and paste them to
> the R console the graphs appear in the file.

And that is `running the script'.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595