Re: [R] Efficient way of creating a shifted (lagged) variable?

2011-08-04 Thread Ken H
Hey all, Correct me if I'm wrong but, the 'stats' package has a lag() function like so lagged.series=lag(series,number of lags wanted) Furthermore, I am pretty sure that lag( ) accepts negative lags:=> leads. lag(x,1)=> object of one lag, lag(x,-1) object with one lead

Re: [R] Loop: noob question

2011-08-05 Thread Ken H
Hey, no problem! We all have to start somewhere, welcome to R! The structure of the for loop is as follows: First lets define the number you want, say >vector.size = 10 First allocate an empty vector to store the results, you could do this like so > V95.Vector<-c() But I recommend you do

Re: [R] Loop: noob question

2011-08-05 Thread Ken H
R is pretty good if you're into that kind of thing... Did not know about the data manipulation or graphics books, I'll definitely be checking those out. Thanks for the info, Ken On Fri, Aug 5, 2011 at 1:16 PM, Joshua Wiley wrote: > On Fri, Aug 5, 2011 at 9:20 AM, Ken