Displaying 1 result from an estimated 1 matches for "characterseq".
Did you mean:
characterset
2011 Feb 03
2
substring and paste character with a for loop
...n simple example of my problem.
I want to delet the commas in the character string. Fore this reason I
create a for loop to unpick the string and rebuild him without the commas.
The problem is, that "paste" does not work in the loop as I expected.
text <- "aaa,bbb,ccc,ddd"
characterseq <- seq(1,15,4)
for (i in characterseq ){
m <- paste(substring(text,i,i+2),sep = "")
}
> m
[1] "ddd"
m should be "aaabbbcccddd" and not just "ddd"
with best regards
Chris
--
View this message in context: http://r.789695.n4.nabble.com/substrin...