Elegant Henrique, thanks !

----------------Contact
Details:-------------------------------------------------------
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------




On Sun, May 9, 2010 at 1:23 AM, Henrique Dallazuanna <www...@gmail.com>wrote:

> Try this also:
>
> colSums(sapply(nombreC, grepl, nombreL))
>
>
> On Sat, May 8, 2010 at 5:22 AM, Sebastian Kruk <residuo.so...@gmail.com>wrote:
>
>> 2010/5/8 Tal Galili <tal.gal...@gmail.com>:
>> > Hi Sebastian,
>> > Please check if this does what you want:
>> >
>> > nombreL <- c("Alvaro Perez", "Sebastián García", "Luis Gomez", "Jorge
>> Rial",
>> > "Ronaldo Apud", "Ana María Bianco")
>> > nombreC <- c("Alvaro", "Ana","Jorge","Ronaldo", "Sebastian")
>> > func1 <- function(x)
>> > {
>> > grep(x, noquote(nombreL))
>> > }
>> > lapply(noquote(nombreC), func1)
>>
>> Hi Tal, I just want to count how many time appear any element of
>> nombreC in nombreL.
>>
>> Alvaro appear once in nombreL so cuenta = 1
>> Ana appear 0 times in nombreL so cuenta = 1
>> Jorge appear 0 times in nombreL so cuenta = 1
>> Ronaldo appear 0 times in nombreL so cuenta = 1
>> Sebastian appear once in nombreL so cuenta = 1+1
>>
>> Sebastian.
>>
>> ______________________________________________
>> 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 provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>

        [[alternative HTML version deleted]]

______________________________________________
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 provide commented, minimal, self-contained, reproducible code.

Reply via email to