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)
----------------Contact
Details:-------------------------------------------------------
Contact me: [email protected] | 972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------
On Sat, May 8, 2010 at 10:46 AM, Sebastian Kruk <[email protected]>wrote:
> Hi, for example I have two list:
>
> 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",...)
>
> and my code is:
>
> cuenta <- 0
> topL <- length(nombreL)
> topC <- length(nombreC)
> for (i in 1:topL) {
> for (j in 1:topC) {
> k <-
> grep(noquote(nombreL[i]),nombreC[j])
> if (length(k) > 0){
>
> cuenta <- cuenta + 1
> }
> }
>
> Thanks,
>
> Sebastian.
>
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.