Re: [R] using double loops and saving the data

2010-04-12 Thread ChinChin
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]

[R] using double loops and saving the data

2010-04-11 Thread ChinChin
Hi, I am the first R user, I have met some problem and I am seeking for help. I am estimating the wealth of a shareholder. First, I simulated 1 set of price, each set of price contains 5200 prices which reflect the price goes up and down through out the year. Price # consists of all set

Re: [R] using double loops and saving the data

2010-04-11 Thread ChinChin
David Winsemius wrote: I am guessing that the first time through when i= 5200 that i+1 is indexing an entry that does not exist. What does str( Price[[1]] [5200+1] ) return? What about str(Ca)? So what is supposed to happen when you try Ca[5200+1] - ... anything? Really? I