Re: [R] shift and pop equivalent in R

2010-04-20 Thread Xie Chao
Thanks Barry for the code sample, and Thanks Duncan for the clarification. Both replies help a lot! Best Regards, Xie Chao On Wed, Apr 21, 2010 at 2:50 AM, Barry Rowlingson wrote: > On Tue, Apr 20, 2010 at 7:03 PM, Xie Chao wrote: >> Dear All, >> >> I am wondering is there any shift (or pop o

Re: [R] shift and pop equivalent in R

2010-04-20 Thread Barry Rowlingson
On Tue, Apr 20, 2010 at 7:03 PM, Xie Chao wrote: > Dear All, > > I am wondering is there any shift (or pop or push or unshift) equivalent in R? > For example, > shift(x)   # should return x[1], and x becomes x[-1] > I seem to have implemented a FIFO stack in 2003: http://finzi.psych.upenn.edu/R

Re: [R] shift and pop equivalent in R

2010-04-20 Thread Duncan Murdoch
On 20/04/2010 2:03 PM, Xie Chao wrote: Dear All, I am wondering is there any shift (or pop or push or unshift) equivalent in R? For example, shift(x) # should return x[1], and x becomes x[-1] Not in base R. Generally speaking, functions with side effects are frowned upon. It is possibl