[R] Loop over a split string

Uwe Ligges ligges at statistik.tu-dortmund.de
Wed May 11 11:16:12 CEST 2011



On 11.05.2011 11:12, Joel wrote:
> 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?

Please ask your supervisor for advices related to your homework.

Uwe Ligges


>
> //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.



More information about the R-help mailing list