标签:one select 1.5 sub 移除 mon [1] air win
> x<-c(6,1,2,3,NA,12)
> x[x>5] #x[5]是未知的,因此其值是否大于5也是未知的
[1] 6 NA 12
> subset(x,x>5) #subset直接会把NA移除
[1] 6 12
> subset(airquality, Temp > 80, select = c(Ozone, Temp))
Ozone Temp
29 45 81
35 NA 84
36 NA 85
38 29 82
39 NA 87
40 71 90
...
> subset(airquality, Day == 1, select = -Temp)
Ozone Solar.R Wind Month Day
1 41 190 7.4 5 1
32 NA 286 8.6 6 1
62 135 269 4.1 7 1
93 39 83 6.9 8 1
124 96 167 6.9 9 1
...
> subset(airquality, select = Ozone:Wind)
Ozone Solar.R Wind
1 41 190 7.4
2 36 118 8.0
3 12 149 12.6
4 18 313 11.5
5 NA NA 14.3
...
标签:one select 1.5 sub 移除 mon [1] air win
原文地址:http://www.cnblogs.com/wwxbi/p/6087341.html