[R] Deleting a particular row

Sundar Dorai-Raj sundar.dorai-raj at PDF.COM
Tue Oct 5 20:03:00 CEST 2004



S Peri wrote:

> Hi,
>   I have a data frame. 
> E.g:
> 
>              Fertility Agriculture
> Courtelary        80.2        17.0
> Delemont          83.1        45.1
> Franches-Mnt      92.5        39.7
> 
> 
> How can I delete :
> Courtelary        80.2        17.0
> 
> 
> Thanks.
> 
> P
> 

See ?subset. Assuming your data is called `mydata':

subset(mydata, Fertility != 80.2 | Agriculture != 17.0)

Note the single `|' for OR. See ?Logic for explanation.

--sundar




More information about the R-help mailing list