[R] SQL like function?

Benilton Carvalho bcarvalh at jhsph.edu
Fri Sep 7 06:46:14 CEST 2007


observation %in% ID

b

On Sep 7, 2007, at 1:40 AM, Takatsugu Kobayashi wrote:

> Hi RUsers,
>
> I am wonder if I can search observations whose IDs matches any of the
> values in another vector, such as in MySQL. While I am learing  
> MySQL for
> future database management, I appreciate if anyone could give me a  
> hint.
>
> Suppose I have one 5*1 vector containing observation IDs and
> frequencies, and one 3*1 vector containing observation IDs.
>
> observation<-c(1,2,3,4,5)
> ID<-c(1,3,4)
>
> Then, I would like to program a code that returns a results showing
> matched observations like
>
> result: TRUE FALSE TRUE TRUE FALSE
>
> I am reading S programming, but I cannot find a way to do this.
>
> Thank you very much.
>
> Taka
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.



More information about the R-help mailing list