[R] Loop over a split string

From: Joel <joda2457_at_student.uu.se>
Date: Wed, 11 May 2011 02:12:54 -0700 (PDT)


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.

______________________________________________
R-help_at_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.
Received on Wed 11 May 2011 - 09:14:59 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 11 May 2011 - 09:30:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive