<br><br><div><span class="gmail_quote">2007/10/9, Thomas Friedrichsmeier <<a href="mailto:thomas.friedrichsmeier@ruhr-uni-bochum.de">thomas.friedrichsmeier@ruhr-uni-bochum.de</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Sunday 07 October 2007, you wrote:<br>> Yeap, there is a great difference. This solves the problem and makes it as<br>> fast as it should. However i cannot use pdf() function with xyplot.<br>> Example:<br>> pdf("
plot.pdf")<br>> xyplot(bla bla bla)<br>> dev.off()<br>><br>> does not produces plots, although my data exists.<br><br>You mean this is, when you run inside local()? No idea on this problem.</blockquote><div>
<br>Yeap. The  same problem I have when I source the script file in R. If it helps. <br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> Here is a very silly example showing however the problem:<br><br>Thanks. Looking at it, the object browser is not quite as much to blame as I<br>thought. Rather the time problem seems to be detection of object<br>modifications (yes, ultimately, that is for the object browser). The problem
<br>in your code is that it has lots and lots of assignments inside<br>the .globalenv(), and for each of these we take a note that object "m1" has<br>changed, and should be updated after the command has finished.
<br><br>Compare this to this example:<br><br>n=100<br>m=213<br>m1<-matrix(nrow=n*m, ncol=5)<br>local({<br>        for (i in 1:n){<br>         for (j in 1:m){<br>         m1[(i-1)*m+j,1]=(i-1)*j+j<br>         m1[(i-1)*m+j,2]=i*j+1
<br>         m1[(i-1)*m+j,3]=i*j+2<br>         m1[(i-1)*m+j,4]=i*j+3<br>         m1[(i-1)*m+j,5]=i*j+4<br>         }<br>        }<br>        m1 <<- m1<br>})</blockquote><div><br>This <<- symbol means that it makes a local variable global? Is this local function R's or rkward's function? I tried in R and it seems to work too. 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.
<br></div><br>Thanx,<br><br>Regards,<br>Ilias<br></div><br>