<body>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">Hi</span></font></div>
<div align="left"><br></div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">On 30 Sep 2002 at 14:12,
Katja Loytynoja wrote:</span></font></div>
<div align="left"><br></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
Hello everyone,</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
could anyone tell me how to get results from a loop as a vector. I've</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
tried</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
> d<-3; nro<-7; i<-0</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
> for(i in 1:d){ottonro<-ottonro+const; print(ottonro)}</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
[1] 13</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
[1] 19</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
[1] 25</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
and</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
> d<-3; nro<-7; i<-0</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
> for(i in 1:d){nro[i]<-nro+const; print(nro)}</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
[1] 13</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
[1] 13 19</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
[1] 13 19 19</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
Warning message: </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
number of items to replace is not a multiple of replacement length </span></font></div>
<div align="left"><br>
</div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">does something like this
be OK?</span></font></div>
<div align="left"><br>
</div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">start<-13</span></font></div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">const<-6</span></font></div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">opak<-2</span></font></div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">cumsum(c(start,rep(const,opak)))</span></font></div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">[1] 13 19 25</span></font></div>
<div align="left"><br>
</div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">or if you prefer loop</span></font></div>
<div align="left"><br>
</div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">x<-13</span></font></div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">for (i in 1:2) x[i+1]<-x[i]+6</span></font></div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">x</span></font></div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">[1] 13 19 25</span></font></div>
<div align="left"><br>
</div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">(not sure what will be
quicker:-)</span></font></div>
<div align="left"><br></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
but neither work. Any help would be much appreciated.</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
regards,</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
Katja Löytynoja</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
-------------------------------------------------------------------</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
Katja Löytynoja, Taitoniekantie 9 D 505, 40 740 Jyväskylä, Finland </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> tel. +35850 336 0174, mail kaloytyn@jyu.fi</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">> </span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
-.-.-.-.- r-help mailing list -- Read</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help",</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
or "[un]subscribe" (in the "body", not the subject !) To:</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
r-help-request@stat.math.ethz.ch</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.</span></font></div>
<div align="left"><font face="Times New Roman CE" color="#7f0000"><span style="font-size:12pt">>
_._._._._</span></font></div>
<div align="left"><br>
</div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">Cheers</span></font></div>
<div align="left"><br>
</div>
<div align="left"><br></div>
<div align="left"><br>
</div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">Petr Pikal</span></font></div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">petr.pikal@precheza.cz</span></font></div>
<div align="left"><font face="Times New Roman CE"><span style="font-size:12pt">p.pik@volny.cz</span></font></div>
<div align="left"></div>
</body>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._