You could try this:

i <- c(5, 8)
a <- list(a1, a2, a3, a4)
subset(stack(as.data.frame(sapply(a, '[', 1:max(sapply(a, length))))),
       values %in% i, ind)

On Thu, Jun 17, 2010 at 8:40 PM, song song <rprojecth...@gmail.com> wrote:

> for example, I have
>
> a1=c(1,3,5)
> a2=c(2,4,6)
> a3=c(7,8)
> a4=c(9,10)
>
> now if I have i=5, so i in a1, then I get a feedback tag[5]=1
>                   i=8,  so i in a3, then can get tag[8]=3
>
> in there any function to do this to check the element belongs to which
> group?
>
> thank you!!!
>
>        [[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.
>



-- 
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