As long as you keep in mind Prof. Ripley's comment, you're going to be fine with nchar().
http://tolstoy.newcastle.edu.au/R/e2/devel/07/05/3450.html Remember that what you want exactly is given by nchar(obj, type="chars"), which is **NOT** the default on R 2.5.1 (only on R-2.6.0). In your particular situation, assuming R-2.5.1, nchar(obj) works, but i'm afraid it's only a coincidence. b On Sep 5, 2007, at 11:05 AM, (Ted Harding) wrote: > 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) <[EMAIL PROTECTED]> > Fax-to-email: +44 (0)870 094 0861 > Date: 05-Sep-07 Time: 15:05:22 > ------------------------------ XFMail ------------------------------ > > ______________________________________________ > R-help@stat.math.ethz.ch 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. ______________________________________________ R-help@stat.math.ethz.ch 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.