[R] results from loop as a vector

Katja Loytynoja kaloytyn at cc.jyu.fi
Mon Sep 30 13:12:52 CEST 2002


Hello everyone,

could anyone tell me how to get results from a loop as a vector. I've 
tried

> d<-3; nro<-7; i<-0
> for(i in 1:d){ottonro<-ottonro+const; print(ottonro)}
[1] 13
[1] 19
[1] 25

and

> d<-3; nro<-7; i<-0
> for(i in 1:d){nro[i]<-nro+const; print(nro)}
[1] 13
[1] 13 19
[1] 13 19 19
Warning message: 
number of items to replace is not a multiple of replacement length 


but neither work. Any help would be much appreciated.

regards,
Katja Löytynoja


-------------------------------------------------------------------
Katja Löytynoja, Taitoniekantie 9 D 505, 40 740 Jyväskylä, Finland             
tel. +35850 336 0174, mail kaloytyn at jyu.fi


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list