[R] extract from a data frame

Julien Barnier jbarnier at ens-lsh.fr
Mon Apr 23 10:35:43 CEST 2007


Hi,

> I'd like know how to do to extract data from a frame for example
> how can I do to extract only the data where variety=victory or variety=golden rain
> thanks.
>
>> Oats
>    Block     Variety nitro yield
> 1      I     Victory   0.0   111
> 2      I     Victory   0.2   130


You can try :

Oats[variety==Victory || Variety==Golden, ]

See also help on the subset function.

HTH,

Julien

-- 
Julien Barnier
Groupe de recherche sur la socialisation
ENS-LSH - Lyon, France



More information about the R-help mailing list