[rkward-devel] Problem with big objects

I. Soumpasis nono.231 at gmail.com
Sun Oct 7 17:05:01 UTC 2007


2007/10/7, Thomas Friedrichsmeier <thomas.friedrichsmeier at ruhr-uni-bochum.de
>:
>
> Hi Ilias,
>
> On Saturday 06 October 2007, I. Soumpasis wrote:
> > This time of my working life I am trying to do some models that they use
> > odesolve together with simulation. The result of my work is to create
> big
> > tables (like 213 x 1000 (or more)). When I try to do this with rkward it
> > takes ages to be done. I suspect this is because of the rkward workspace
> > browser trying to translate the object. Is there a posibility to make a
> > choice in order to activate/deactiate this browser (if this is the
> > problem). What I am trying to do is to write my script in the editor and
> > run it. No need for the browser to show me anything. Using plain R,
> Rcmdr
> > and JGR the scripts are done in a few minutes, but in rkward I cannot
> wait
> > so much time to see it ending.
>
> generally, the workspace browser does not cause much slowdown unless
> dealing
> with objects that contain many "child" objects. That said, there may well
> be
> issues when dealing with large tables. First, in order to make sure the
> workspace browser really is the issue, please try running your code inside
> local(). E.g.:
>         local({
>                 x <- whatever()
>         })
> If this is considerably faster than
>         x <- whatever()
> then in fact, the workspace browser is to blame. Otherwise, we'll need to
> look
> elsewhere.


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.

Regardless of the outcome, could you produce an example that shows this
> problem?


Here is a very silly example showing however the problem:

n=100
m=213
m1<-matrix(nrow=n*m, ncol=5)
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
    }
}
print(m1)

and with local

local({
n=100
m=213
m1<-matrix(nrow=n*m, ncol=5)
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
    }
}
print(m1)
})

If you change n to bigger number then the problem is even bigger.

Kind Regards,
Ilias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20071007/5204a54a/attachment.html>


More information about the Rkward-devel mailing list