Re: [R] ask a question about data sets element

From: Dennis Murphy <djmuser_at_gmail.com>
Date: Fri, 18 Jun 2010 03:24:24 -0700

Hi:

Here's another approach:

library(reshape)
l <- list(a1, a2, a3, a4)
ll <- melt(l)
ll[ll$value %in% i, 'L1']
# [1] 1 3

HTH,
Dennis

On Thu, Jun 17, 2010 at 4:40 PM, song song <rprojecthelp_at_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_at_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_at_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. Received on Fri 18 Jun 2010 - 10:27:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Jun 2010 - 11:30:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive