[R] selecting by variable

Salvador Alcaraz Carrasco salcaraz at obelix.umh.es
Wed Aug 27 17:49:10 CEST 2003


On Wed, 27 Aug 2003, Petr Pikal wrote:

> Hallo
>
> On 27 Aug 2003 at 1:49, Eugene Salinas wrote:
>
> > Hi,
> >
> > I'm a recent R convert so I haven't quite figured out
> > the details yet...
> >
> > 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)])
>
> if A and B are objects storing your limits
>
> ?Logic
> ?"["
>
> >
> > (The data is for individuals and each individual has a
> > number of characteristics including X and Y).
> >
> > thanks, eugene.
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
> Cheers
> Petr Pikal
> petr.pikal at precheza.cz
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>

__________________________________________________________________________
Salvador Alcaraz Carrasco                      http://www.umh.es
Arquitectura y Tecnología de Computadores      http://obelix.umh.es
Dpto. Física y Arquitectura de Computadores    salcaraz at umh.es
Universidad Miguel Hernández                   salcaraz at obelix.umh.es
Avda. del ferrocarril, s/n                     Telf. +34 96 665 8495
Elche, Alicante (Spain)




More information about the R-help mailing list