3
I have two vectors:
A <- c("RS", "DF", "CE")
B <- c("Porto Alegre - RS", "Brasília - DF", "Fortaleza - CE", "Porto Alegre - RS",
"Acre - AC", "Recife - PE")
and a function:
f <- function(a,b) {
lista <- grep(a,b, fixed = FALSE)
return(lista)
}
mm <- lapply(A, B, FUN = f)
I’m getting the position of the elements from A to B, but I need the elements from B and not the position.
I thought this would work:
B[mm]
But it didn’t. How do I do it?
Is that R? format code, put language tags, will help your question get more visibility
– ldeoliveira
Yeah, thanks for the tip.
– Fernando
nothing, just give up there xD
– ldeoliveira