[rkward-devel] Problem with big objects
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Oct 9 11:02:38 UTC 2007
On Sunday 07 October 2007, you wrote:
> Yeap, there is a great difference. This solves the problem and makes it as
> fast as it should. However i cannot use pdf() function with xyplot.
> 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.
> Here is a very silly example showing however the problem:
Thanks. Looking at it, the object browser is not quite as much to blame as I
thought. Rather the time problem seems to be detection of object
modifications (yes, ultimately, that is for the object browser). The problem
in your code is that it has lots and lots of assignments inside
the .globalenv(), and for each of these we take a note that object "m1" has
changed, and should be updated after the command has finished.
Compare this to this example:
n=100
m=213
m1<-matrix(nrow=n*m, ncol=5)
local({
for (i in 1:n){
for (j in 1:m){
m1[(i-1)*m+j,1]=(i-1)*j+j
m1[(i-1)*m+j,2]=i*j+1
m1[(i-1)*m+j,3]=i*j+2
m1[(i-1)*m+j,4]=i*j+3
m1[(i-1)*m+j,5]=i*j+4
}
}
m1 <<- m1
})
Here, the object is written back to globalenv, and will be analysed by the
workspace browser as before. However, only a limited number of assignments
happens in globalenv in total, and that makes a world of a difference.
Well, no good idea on dealing with this, yet, but I'll make a note on the TODO
list.
Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20071009/a59df753/attachment.sig>
More information about the Rkward-devel
mailing list