[rkward-devel] Problem with big objects
I. Soumpasis
nono.231 at gmail.com
Wed Oct 10 09:33:48 UTC 2007
2007/10/9, Thomas Friedrichsmeier <thomas.friedrichsmeier at ruhr-uni-bochum.de
>:
>
> On Tuesday 09 October 2007, I. Soumpasis wrote:
> > > > Example:
> > > > pdf("plot.pdf")
> > > > xyplot(bla bla bla)
> > > > dev.off()
> > > >
> > > > does not produces plots, although my data exists.
> > >
> > > You mean this is, when you run inside local()? No idea on this
> problem.
> >
> > Yeap. The same problem I have when I source the script file in R. If it
> > helps.
>
> Ok, I looked into this. The problem is that xyplot() does not actually
> print
> the plot automatically, but merely produces a plot object. When you run
> the
> statements one by one on the command line, the resulting object is
> auto-printed, causing it to be sent to the pdf() device.
>
> However, if you lump the calls together then no auto-printing happens.
> This is
> not specific to local({}), but to anything that is evaluated in one go:
> {
> pdf("plot.pdf")
> xyplot(...)
> dev.off()
> }
> does not work either, same as source(). Solution: call print() or plot()
> explicitely. E.g.:
> local ({
> pdf("plot.pdf")
> print (xyplot(...))
> dev.off()
> })
> will work as expected.
>
> > This <<- symbol means that it makes a local variable global?
>
> Yes, it's exactly like "<-" except it always assigns in the globalenv().
>
> > Is this local
> > function R's or rkward's function? I tried in R and it seems to work
> too.
>
> Yes, it's an R base function. We just happen to use it a lot in RKWard.
>
> > In RKWard it is really fast this way you are right. I will try to do it
> in
> > my script. I just tried the example and it is really fast.
>
> Another way (which is even better), is to put your code inside a function.
> This, too will avoid the many assignments in globalenv().
Thanx Thomas! All these hints were really helpful.
Really appreciate that.
When my scripts are finished and (hopefully) the results are published R
RKWard and some function libraries will have a citation.
Kind Regards,
Ilias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20071010/27f9373c/attachment.html>
More information about the Rkward-devel
mailing list