[R] Loop over a split string

Joel joda2457 at student.uu.se
Wed May 11 11:12:54 CEST 2011


Hi

I got a string that looks like this:

string<-"a b c d e f"

And what I wanna do is loop trough all the letters.
like

for(i in string){
 print(i)
}

would render the result:
a
b
c
d
e
f

Ive tried using strsplit but without result, dose anyone know how I could
make this happen?

//Joel

--
View this message in context: http://r.789695.n4.nabble.com/Loop-over-a-split-string-tp3514204p3514204.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list