Re: [R] rectify a program of seasonal dummies matrix

2007-08-22 Thread Uwe Ligges
Friedrich Schuster wrote: Hello, the main problem seems to be the if else, should be else if. Your code is hard to read, maybe you should consider using more () {}: T - 100; br - matrix(0,T,4); Thanks for the contribution. Please note: a) It is a bad idea to have a variable

[R] rectify a program of seasonal dummies matrix

2007-08-21 Thread hassen62
Hi friends, I would like to construct a matrix of seasonal dummies with number of rows (observations)=100. such matrix is written as follows:[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1;1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1;etc...] . I wrote the following program: T=100 br=matrix(0,T,4) { for (i in 1:T) for (j

Re: [R] rectify a program of seasonal dummies matrix

2007-08-21 Thread jim holtman
Your syntax is wrong; e.g., if i==j should be if (i == j) same with your use of 'if else'. You need to use the correct syntax. Your example is hard to follow without the correct indentation since you are using the incorrect syntax. On 8/21/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi

Re: [R] rectify a program of seasonal dummies matrix

2007-08-21 Thread Friedrich Schuster
Hello, the main problem seems to be the if else, should be else if. Your code is hard to read, maybe you should consider using more () {}: T - 100; br - matrix(0,T,4); for (i in 1:T) { for (j in 1:4) { if (i==j) { br[i,j] - 1; } else if ((abs(i-j)%%4)==0) {