Thank all you guys for the great help~. I appreciate
--
View this message in context:
http://r.789695.n4.nabble.com/R-string-functions-tp3600484p3600975.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
Hi,
On Wed, Jun 15, 2011 at 4:37 PM, karena wrote:
> Hi,
>
> I have a string "GGCCCAATCGCAATTCCAATT"
>
> 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,
a.m.
> To: r-help@r-project.org
> Subject: [R] R string functions
>
> Hi,
>
> I have a string "GGCCCAATCGCAATTCCAATT"
>
> 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
;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.
_
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 c
Maybe I don't understand the question. I can think of four ways to
count, none of which give me 7:
a <- "Hello World"
b <- "Hello Peter"
#counting duplicates and the space:
sa <- strsplit(a, split="")[[1]]
sb <- strsplit(b, split="")[[1]]
length(which(sb %in% sa == TRUE))
#counting the space but
Laetitia,
One approach:
lettermatch <- function(stringA, stringB) {
sum(unique(unlist(strsplit(stringA, ""))) %in%
unique(unlist(strsplit(stringB, ""
}
lettermatch("Hello World","Hello Peter")
yields 6, as the l is only singly counted.
This treats uppercase and lowercase as different
On 1/9/10, Laetitia Schmid wrote:
> Does anybody know a string function that would calculate how many characters
> two strings share? I.e. ("Hello World","Hello Peter") would be 7.
>
Perhaps package ‘stringr’ has something related?
Liviu
__
R-help@r-p
Hi!
Does anybody know a string function that would calculate how many
characters two strings share? I.e. ("Hello World","Hello Peter") would
be 7.
Thanks.
Laetitia
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PL
On Sep 14, 2008, at 1:53 PM, zubin wrote:
Hello, trying to locate all the string commands in the base version
of R, can't seem to find an area that describes them. I am in need
to do some serious parsing of text data to create my dataset. Is
there a summary link to all the character opera
Try this:
help.search(keyword = "character", package = "base")
Then read each of the pages listed to get info on the indicated command
plus related commands also described on those pages (but not necessarily
listed in the help.search list).
You might also want to look at the gsubfn package and
Start with
?grep
and then follow the "See Also". Exactly what type of serious parsing
are you trying to do? R can do some, but if it is very complex, you
might want to consider awk/perl.
On Sun, Sep 14, 2008 at 1:53 PM, zubin <[EMAIL PROTECTED]> wrote:
> Hello, trying to locate all the string
On Sep 14, 2008, at 1:53 PM, zubin wrote:
Hello, trying to locate all the string commands in the base version
of R, can't seem to find an area that describes them. I am in need
to do some serious parsing of text data to create my dataset. Is
there a summary link to all the character opera
Hello, trying to locate all the string commands in the base version of
R, can't seem to find an area that describes them. I am in need to do
some serious parsing of text data to create my dataset. Is there a
summary link to all the character operators? string manipulations that
would help in
14 matches
Mail list logo