Petr Pikal wrote: > > > You did not tell much more about your data and procedures. Each object > type has some distinct way of indexing and you can not mix them up. > > x<-1:10 >> x[5] > [1] 5 >> x[[5]] > [1] 5 >> x[5,] > Error in x[5, ] : incorrect number of dimensions > >> x<-list(1:10) >> x[1] > [[1]] > [1] 1 2 3 4 5 6 7 8 9 10 > >> x[5] > [[1]] > NULL > >> x[[5]] > Error in x[[5]] : subscript out of bounds > >> x[1][5] > [[1]] > NULL > >> x[[1]][5] > [1] 5 > > Nobody except you has your data available, so without providing more clues > you can not expect mor relevant answers. > > Try str(your.objects) and maybe you could use debug to see how they are > operating and changing through a cycle. > > I think I got what you mean, so that I can't use the "Wealth1[[s]][i] <- Ca[i+1]+Po[i+1]" in the last line of loops.
Is there any code I can use the store the data? I aim to store the data like : a <- "x1" "x2" "x3" "x4" ... and in each entry of a x1 <- 1 2 3 4 5 6 7 ... the entries in "x1" are the "wealth" that I want estimate. Please tell me the code to store these type of data. Thanks. :) actually I can create the Price[[i]] by coding "Price = list()" before I simulate the price -- View this message in context: http://n4.nabble.com/using-double-loops-and-saving-the-data-tp1836591p1836938.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.