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

[R] problem with nested loops

2013-02-26 Thread Richard Saba
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=dat70. However the code fails to execute if I specify the mo

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

[R] problem with nested loops

2008-07-30 Thread Jens Oldeland
Dear all, I have a problem with constructing a nested loop. I have two matrices: pnr: 800 rows 14 columns where rows are 40x20 meaning that 40 rows belong to one of twenty objects in the matrix pnr mvp: 20 rows and 14 columns I want to: calculate a distance value with the first 40 rows of