Re: [R] Matching a character in a string

2010-01-25 Thread Fabrice DELENTE
> grep("o", "hello") Thanks, I hadn't noticed R has grep included! -- Fabrice DELENTE __ R-help@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 pr

Re: [R] Matching a character in a string

2010-01-25 Thread GlenB
See also ?unlist (you can unlist(strsplit(...)) for the same effect -- View this message in context: http://n4.nabble.com/Matching-a-character-in-a-string-tp1289795p1290011.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pro

Re: [R] Matching a character in a string

2010-01-25 Thread GlenB
The output from strsplit("hello","") is not suitable as input for the second argument for charmatch. compare with: charmatch("o",strsplit("hello","")[[1]]) -- View this message in context: http://n4.nabble.com/Matching-a-character-in-a-string-tp1289795p1289976.html Sent from the R help maili

Re: [R] Matching a character in a string

2010-01-25 Thread Paul Hiemstra
Fabrice DELENTE wrote: Hello. Sorry for this very basic question but I didn't find (of didn't understand) the answer either in the help or in the online guide. I have a string, let's say "hello". I want to know if there is some character in it, let's say an 'o'. I tried charmatch("o", str

[R] Matching a character in a string

2010-01-25 Thread Fabrice DELENTE
Hello. Sorry for this very basic question but I didn't find (of didn't understand) the answer either in the help or in the online guide. I have a string, let's say "hello". I want to know if there is some character in it, let's say an 'o'. I tried > charmatch("o", strstplit("hello","")) but it