# R: R: [R] retrieve rows from frame assuming criterion [corrected]

Guazzetti Stefano Stefano.Guazzetti at ausl.re.it
Fri Jul 23 17:08:20 CEST 2004

```Yes,
paraphrasing Murphy I can say of myself:

"Nothing seems to be able to stop a stupid thought
in its pathway from the brain to the keyboard".  :-)

Sorry once again and thank for your patience.

Stefano

> -----Messaggio originale-----
> Da: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
> Inviato: venerdì 23 luglio 2004 16.30
> A: Guazzetti Stefano
> Cc: Luis Rideau Cruz; r-help at stat.math.ethz.ch
> Oggetto: Re: R: [R] retrieve rows from frame assuming criterion
> [corrected]
>
>
> On Fri, 23 Jul 2004, Guazzetti Stefano wrote:
>
> > sorry for my previus (WRONG)
> > a solution could be
> >
> > subset(data, PUNTAR==c("IX49","IX48"))
>
> That's still wrong.  You want PUNTAR %in% c("IX49","IX48").  Using ==
> recycles entries, so it tests the first element against
> "IX49", the second
> against "IX48", the third against "IX49" ....
>
> > > -----Messaggio originale-----
> > > Da: Guazzetti Stefano
> > > Inviato: venerdì 23 luglio 2004 15.55
> > > A: 'Luis Rideau Cruz'; r-help at stat.math.ethz.ch
> > > Oggetto: R: [R] retrieve rows from frame assuming criterion
> > >
> > >
> > > Assuming your data.frame is called "data"
> > >
> > > data[data\$PUNTAR==c("IX49","IX48"),]
> > >
> > > is probably what you want
> > >
> > > Stefano
>
> --
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
>

```