Hi Maura, It is not "elegant" but may work.
actual.string<- "12345abcdefgh12345abcdefgh" actual.string actual.string<-paste(substr(actual.string, nchar(actual.string),nchar(actual.string)), substr(actual.string, 1,nchar(actual.string)-1), sep="") actual.string #in a looping actual.string<- "12345abcdefgh12345abcdefgh" number.buffers<-10 my.buffers<-actual.string for (i in 1:number.buffers) { actual.string<-paste(substr(actual.string, nchar(actual.string),nchar(actual.string)), substr(actual.string, 1,nchar(actual.string)-1), sep="") my.buffers<-c(my.buffers, actual.string) } my.buffers Ciao, milton brazil=toronto On Sun, May 24, 2009 at 1:09 PM, <mau...@alice.it> wrote: > Some wavelet analysis experts have implemented periodic boundary conditions > for signals. > I need to implement a circular buffer. Something like: > "12345abcdefgh12345abcdefgh" > so that at each step the riightmost element is moved to the leftmost index > and everything else is properly shifted: > "h12345abcdefgh12345abcdefg", "gh12345abcdefgh12345abcdef", .... > > My implementation (still debugging) seems to start working but is terribly > clumsy. > I am sure that some expert can suggest a more elegant solution, > Thank you. > Maura > > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ 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.