Hi Sebastian, Please add an example to the code you made, so to make it easier to help you.
p.s: it seems possible to make it faster using lapply Tal ----------------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 Sat, May 8, 2010 at 10:13 AM, Sebastian Kruk <residuo.so...@gmail.com>wrote: > Hi everybody, I would like to count how many times names in list L, > nombreL, apear in list C, nombreC. > > Can I improve the next program? > > 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 > } > } > > ¿Is there a way to vectorizad? > > Thanks, > > Sebastián. > > Saludos, > > Sebastián. > > ______________________________________________ > 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. > [[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.