[R] Select a group of data from a file

John Kane jrkrideau at yahoo.ca
Fri Jan 18 14:36:20 CET 2008


Hi
? subset  should do it

xx < subset(x, x$Var2==1)
--- "LA SPINA, MICHELANGELO" <michelangelo.la at carm.es>
wrote:

> Hello everybody!
> 
> I've a file with several data six variables, three
> quantitative and three qualitative, I would like to
> select a group of data from the file to analyze
> then, i.e:
> my file is like that (but with 6 variables):
> 
> Var1   Var2
> 2       1
> 5       1
> 8       1
> 7       2
> 3       2
> 8       2
> 
> I want to use only the data where var2 is "1"
> 2       1
> 5       1
> 8       1
> 
> Exist a way in R to create a new dataframe with a
> selection of data from other dataframe?
>
_______________________________________________________________________________________________
> 
> 
> Michelangelo La Spina 
> 
> Equipo de Protección de cultivos - Control Biológico
> 
> Departamento de Biotecnología y Protección de
> Cultivos 
> Instituto Murciano de Investigación y Desarrollo
> Agrario y Alimentario (IMIDA) 
> C/ Mayor s/n
> 30150 La Alberca (Murcia) - ESPAÑA 
> 
> teléfono: +34 968 362 788 
> fax: +34 968 366 792 
> móvil: +34 618 451 079 
> 
> web:
>
http://www.imida.es/equipos/eq_prot_cultivos_comp.html
> e-mail: michelangelo.la at carm.es
> 
> 
> 	[[alternative HTML version deleted]]
> 
> > ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>



More information about the R-help mailing list