[R] ask a question about data sets element

Erik Iverson eriki at ccbr.umn.edu
Fri Jun 18 01:54:21 CEST 2010

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

Not exactly sure what tag[x] is , but I think you want ?%in%

More information about the R-help mailing list