[R] length of a string

(Ted Harding) Ted.Harding at manchester.ac.uk
Wed Sep 5 16:05:25 CEST 2007


On 05-Sep-07 13:50:57, João Fadista wrote:
> Dear all,
>  
> I would like to know how can I compute the length of a string in a
> dataframe. Example:
>  
> SEQUENCE                               ID
> TGCTCCCATCTCCACGG            HR04FS000000645
> ACTGAACTCCCATCTCCAAT      HR00000595847847
>  
> I would like to know how to compute the length of each SEQUENCE.
>  
> Best regards,
> João Fadista

  nchar("ACTGAACTCCCATCTCCAAT")
  [1] 20

seems to work. Find it, and related functions, with

  help.search("character")

As it happens, help.search("string") will not help!

Best wishes,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 05-Sep-07                                       Time: 15:05:22
------------------------------ XFMail ------------------------------



More information about the R-help mailing list