try this: (you were trying to index with non-integer numbers)

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]
        #niether the above, nor res[[i,j]]=i+j work, why?
    }
}





On 12/5/05, Serguei Kaniovski <[EMAIL PROTECTED]> wrote:
>
> Hi, I have a more complex example, but the problem boils down to this
> FOR-loop not filling in the res-matrix
>
> 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 run_rows)
> {
>     for(j in run_cols)
>     {
>         res[i,j]=i+j
>         #niether the above, nor res[[i,j]]=i+j work, why?
>     }
> }
>
> Thank you,
> Serguei
>
> ______________________________________________
> R-help@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
>



--
Jim Holtman
Cincinnati, OH
+1 513 247 0281

What the problem you are trying to solve?

        [[alternative HTML version deleted]]

______________________________________________
R-help@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

Reply via email to