[R] R: extract from a data frame

Guazzetti Stefano Stefano.Guazzetti at ausl.re.it
Mon Apr 23 10:04:07 CEST 2007


Oats[Oats$Variety %in% c("Victory", "Golden Rain"),]
or
subset(Oats, Variety %in% c("Victory", "Golden Rain"))

Stefano

-----Messaggio originale-----
Da: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]Per conto di elyakhlifi
mustapha
Inviato: lunedì 23 aprile 2007 9.56
A: R-help at stat.math.ethz.ch
Oggetto: [R] extract from a data frame


hello,
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
3      I     Victory   0.4   157
4      I     Victory   0.6   174
5      I Golden Rain   0.0   117
6      I Golden Rain   0.2   114
7      I Golden Rain   0.4   161
8      I Golden Rain   0.6   141
9      I  Marvellous   0.0   105
10     I  Marvellous   0.2   140
11     I  Marvellous   0.4   118
12     I  Marvellous   0.6   156
13    II     Victory   0.0    61
14    II     Victory   0.2    91
15    II     Victory   0.4    97
16    II     Victory   0.6   100
17    II Golden Rain   0.0    70
18    II Golden Rain   0.2   108
19    II Golden Rain   0.4   126
20    II Golden Rain   0.6   149
21    II  Marvellous   0.0    96
22    II  Marvellous   0.2   124
23    II  Marvellous   0.4   121


      
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses 

	[[alternative HTML version deleted]]



More information about the R-help mailing list