How's this?

> x = data.frame(ID=c("asdf","asdfasdf"),1:2)
> x
        ID X1.2
1     asdf    1
2 asdfasdf    2
> nchar(as.character(x$ID))
[1] 4 8
>

Assuming ID is a factor, if not, you can remove the as.character().



On 9/5/07, João Fadista <Joao.Fadista@agrsci.dk> 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
>
>         [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>
>

	[[alternative HTML version deleted]]

