Re: [R] Saving a variable

2012-05-06 Thread Joshua Wiley
Hi Trying, Jim already suggested youuse write.table(), which I think is really what you want. I also wanted to point out that your outer loop is unnecessary. The following yields identical results and is *much* faster. randz <- matrix(rnorm(100), 500, 2000) H <- matrix(0, 500, 2000) H[1, ]

Re: [R] Saving a variable

2012-05-06 Thread jim holtman
try write.table(H, file = "datad,txt") On Sun, May 6, 2012 at 5:02 PM, Trying To learn again wrote: > Hi all, > > I´m trying to use write function to save the output of a program (my > constructed "H" matrix) > > > randz<-matrix(rnorm(100),500,2000) > > H<-matrix(0,500,2000) > > H[1,]<-randz

[R] Saving a variable

2012-05-06 Thread Trying To learn again
Hi all, I´m trying to use write function to save the output of a program (my constructed "H" matrix) randz<-matrix(rnorm(100),500,2000) H<-matrix(0,500,2000) H[1,]<-randz[1,] for (j in 1:2000){ for (i in 2:500){ if(i<251) H[i,j]<-0.6*H[i-1,j]+randz[i,j] else H[i,j]<-H[i-1,j]+randz[i,j]