I would like to obtain a matrix
2010/5/8 Tal Galili :
> Here is one way for doing that:
> nombreL <- c("Alvaro Perez", "Sebastian García","Sebastian 2", "Luis Gomez",
> "Jorge Rial", "Ronaldo Apud", "Ana María Bianco")
> nombreC <- c("Alvaro", "Ana","Jorge","Ronaldo", "Sebastian")
> func1 <- funct
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)
---
Try this also:
colSums(sapply(nombreC, grepl, nombreL))
On Sat, May 8, 2010 at 5:22 AM, Sebastian Kruk wrote:
> 2010/5/8 Tal Galili :
> > Hi Sebastian,
> > Please check if this does what you want:
> >
> > nombreL <- c("Alvaro Perez", "Sebastián García", "Luis Gomez", "Jorge
> Rial",
> > "Ronald
func2 <- function(x) which(grepl(x, noquote(nombreL)))
lapply(noquote(nombreC), func2)
Side note: if you wanted the object a in Tal's solution to be a vector,
you could use sapply() rather than lapply(). For this problem, the solution
has to be a list because the position matches are unequal in nu
One last thing, i want to know in which position was founded every name.
2010/5/8 Tal Galili :
> There you go:
>
> nombreL <- c("Alvaro Perez", "Sebastian García","Sebastian 2", "Luis Gomez",
> "Jorge Rial", "Ronaldo Apud", "Ana María Bianco")
> nombreC <- c("Alvaro", "Ana","Jorge","Ronaldo", "Seb
There you go:
nombreL <- c("Alvaro Perez", "Sebastian García","Sebastian 2", "Luis Gomez",
"Jorge Rial", "Ronaldo Apud", "Ana María Bianco")
nombreC <- c("Alvaro", "Ana","Jorge","Ronaldo", "Sebastian")
func1 <- function(x)
{
length(grep(x, noquote(nombreL)))
}
a <- lapply(noquote(nombreC), func1
2010/5/8 Tal Galili :
> 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,
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(n
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(no
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
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) {
11 matches
Mail list logo