[R] What is wrong with this FOR-loop?
Christian Hennig
chrish at stats.ucl.ac.uk
Mon Dec 5 12:54:36 CET 2005
Hi,
I guess that res[i,j] needs integers as indexes.
I would try it like this:
(corrected)
> run_rows<-seq(0,1,0.05)
> run_cols<-seq(0.3,0.6,0.05)
>
> res<-matrix(NA,length(run_rows),length(run_cols))
>
> for(i in 1:length(run_rows))
> {
> for(j in 1:length(run_cols))
> {
> res[i,j]=run_rows[i]+run_cols[j]
> }
> }
>
> Thank you,
> Serguei
Christian
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
*** --- ***
Christian Hennig
University College London, Department of Statistical Science
Gower St., London WC1E 6BT, phone +44 207 679 1698
chrish at stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche
More information about the R-help
mailing list