milton ruser wrote:
> 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.
Still not elegant, but I would split the string first:
spl.str <- unlist(strsplit("12345abcdefgh12345abcdefgh", ""))
Measure its length:
len.str <- length(spl.str)
Shift it:
spl.str <- c(spl.str[len.str], spl.str[seq(len.str - 1)])
Then paste it back together:
paste(spl.str, collapse="") # "h1
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<-
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:
"h1
4 matches
Mail list logo