[R] selecting by variable

Philippe Glaziou glaziou at pasteur-kh.org
Wed Aug 27 11:19:42 CEST 2003


Eugene Salinas <eugenesalinas2003 at yahoo.com> wrote:
> How do I select one variable by another one? Ie if I
> want to draw the histogram of variable X only for
> those individuals that also have a value Y in a
> certain range?
> 
> In STATA I would give something like:
> 
> histogram X if ((Y>=A & Y<=B))

hist(x[Y>=A & Y<=B])

See:
?Subscript
?"&"

-- 
Philippe Glaziou




More information about the R-help mailing list