[R] Length of a string

Ko-Kang Kevin Wang kwan022 at stat.auckland.ac.nz
Sun May 19 00:16:06 CEST 2002


Hi,

Suppose I have created something like this in R:
  foo <- "myfoo"
and I want to find out the number of character in foo (in other words, R
should return 5 since "myfoo" has 5 charactors.

How can I do it?  I tried:
  length(foo)
but it returned 1.

Cheers,

Kevin

------------------------------------------------------------------------------
Ko-Kang Kevin Wang
Postgraduate PGDipSci Student
Department of Statistics
University of Auckland
New Zealand

Homepage: http://www.stat.auckland.ac.nz/~kwan022

E-mail: kwan022 at stat.auckland.ac.nz

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