Re: [R] problem with nested loops

2013-02-26 Thread David Winsemius
On Feb 26, 2013, at 1:53 PM, Richard Saba wrote: > Each of the data sets contains monthly observations on price indices for 7 > countries. I use the fitted values from reg1 in the reg2 model. The interior > loop executes without error as long as I explicitly specify the data set, > i.e. data=d

Re: [R] problem with nested loops

2008-07-30 Thread Kenn Konstabel
What you need is chapter 9 in http://cran.r-project.org/doc/manuals/R-intro.pdf . And you could also use chapter 2, especially 2.2. > specdist <-matrix(NA,nrow=40,ncol=20) > > for (j in 1:40){ > for(i in 1:20){ > specdist[j,i]<-sqrt((pnr[i,1]-mvp[i,1])^2+(pnr[i,2]-mvp[i,2])^2)++(pnr[i,14]-mvp