Re: [R] What is wrong with this FOR-loop?

From: Christian Hennig <chrish_at_stats.ucl.ac.uk>
Date: Mon 05 Dec 2005 - 22:54:36 EST

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@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
>


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 Received on Mon Dec 05 23:01:09 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:28 EST