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

From: Guazzetti Stefano <Stefano.Guazzetti_at_ausl.re.it>
Date: Sat 24 Jul 2004 - 01:08:20 EST

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@stats.ox.ac.uk]
> Inviato: venerd́ 23 luglio 2004 16.30
> A: Guazzetti Stefano
> Cc: Luis Rideau Cruz; r-help@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@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@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
>
>

R-help@stat.math.ethz.ch mailing list