[R] R string functions
Peter Alspach
Peter.Alspach at plantandfood.co.nz
Wed Jun 15 23:55:26 CEST 2011
Tena koe Karena
Try:
table(strsplit("GGGGGGCCCAATCGCAATTCCAATT", ''))
HTH ...
Peter Alspach
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of karena
> Sent: Thursday, 16 June 2011 8:37 a.m.
> To: r-help at r-project.org
> Subject: [R] R string functions
>
> Hi,
>
> I have a string "GGGGGGCCCAATCGCAATTCCAATT"
>
> What I want to do is to count the percentage of each letter in the
> string,
> what string functions can I use to count the number of each letter
> appearing
> in the string?
>
> For example, the letter "A" appeared 6 times, letter "T" appeared 5
> times,
> how can I use a string function to get the these number?
>
> thanks,
>
> karena
>
> --
> View this message in context: http://r.789695.n4.nabble.com/R-string-
> functions-tp3600484p3600484.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org 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.
The contents of this e-mail are confidential and may be subject to legal privilege.
If you are not the intended recipient you must not use, disseminate, distribute or
reproduce all or any part of this e-mail or attachments. If you have received this
e-mail in error, please notify the sender and delete all material pertaining to this
e-mail. Any opinion or views expressed in this e-mail are those of the individual
sender and may not represent those of The New Zealand Institute for Plant and
Food Research Limited.
More information about the R-help
mailing list