[R] Length of a string
Marc Schwartz
MSchwartz at medanalytics.com
Sun May 19 03:11:02 CEST 2002
Kevin,
Use strsplit(foo,"").
> foo <- "myfoo"
> newfoo <- strsplit(foo,"")
> newfoo
[[1]]
[1] "m" "y" "f" "o" "o"
For more information:
?strsplit
Marc
> -----Original Message-----
> From: owner-r-help at stat.math.ethz.ch [mailto:owner-r-
> help at stat.math.ethz.ch] On Behalf Of Ko-Kang Kevin Wang
> Sent: Saturday, May 18, 2002 6:17 PM
> To: Ole Christensen
> Cc: R Help
> Subject: Re: [R] Length of a string
>
> It worked! Thanks a lot for the prompt reply.
>
> However this remind me of another question. If I entered my string
like:
> foo <- "myfoo"
> then, if there anyway to convert foo into a form that is:
> c("m", "y", "f", "o", "o")
> directly?
>
> Thanks again in advance,
>
> Kevin
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list