[R] again troubles with lattice
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu May 8 11:11:25 CEST 2003
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
More information about the R-help
mailing list