Exclude NA from vector of observations

> f<-outcome2[,11]
> f
  [1] 16.1 16.3 15.7   NA 17.4 15.7 12.9 17.4 18.1 16.0 16.4 15.4 21.6 14.5 16.1 15.1
 [17] 17.4 16.6 18.8 13.6 14.2 14.5 16.8 15.6   NA 13.9   NA 14.0 14.9 15.7 17.3 13.3
 [33]   NA   NA 15.1 16.1   NA 15.7   NA 16.3 15.3 15.5 18.7   NA 16.2 14.6 15.2 15.8
 [49] 14.6 15.5   NA 16.2 17.2 14.0 15.7 16.9 14.9 15.7   NA   NA 16.1 15.2 14.0 16.3
 [65]   NA   NA   NA 13.9 13.5 14.7   NA 16.0 17.9   NA 14.8 14.4 17.9 15.6 19.4 16.5
 [81] 17.2 15.0 14.3 15.7   NA   NA   NA 17.3 15.6 13.1 16.9   NA 14.9 13.9   NA   NA
 [97]   NA   NA 16.2 14.7 15.0   NA 14.3 17.0   NA 16.0 16.6   NA 18.5 16.2 16.2 16.6
[113]   NA   NA 15.2 16.3 12.9   NA   NA 15.2   NA 15.2 16.2 16.4   NA   NA 15.0 14.9
[129]   NA   NA   NA 13.5 16.2   NA   NA 17.7   NA   NA 17.5 17.2 16.6 15.5 16.5   NA
[145]   NA   NA   NA 16.4 16.1 16.3   NA 17.2 16.0   NA 14.5   NA   NA 16.4   NA   NA
[161] 14.7   NA 16.7 17.1 15.9   NA 15.4 17.1 16.2 14.1   NA 16.1 18.9 12.4 16.0   NA
[177]   NA 17.2 16.3 15.8 15.4 16.8 15.2 16.3   NA 14.4 18.0 16.7 16.5 16.2 13.3 15.5
[193] 17.1   NA 17.6 14.3 14.8 15.3 16.6 18.7 18.1 15.6 15.9 15.5   NA 15.8 15.2 14.3
[209] 14.9 12.0 16.1 17.7 15.2 16.6 15.6   NA 17.2   NA 13.6 16.1   NA   NA   NA 14.5
[225]   NA 15.5 14.7   NA 16.2   NA   NA   NA 17.7 14.9   NA   NA 15.9   NA 14.6 16.8
[241]   NA   NA 15.7   NA 15.2   NA   NA   NA   NA 13.1   NA 16.8 16.1 14.9   NA 13.8
[257]   NA   NA 15.2   NA   NA   NA 16.2 15.6   NA   NA   NA   NA 14.0 15.2   NA   NA
[273]   NA 17.1   NA   NA   NA 15.7   NA   NA   NA 15.0   NA   NA   NA   NA   NA   NA
[289]   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA
[305]   NA 16.0   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA
[321]   NA   NA   NA   NA   NA   NA   NA 16.5   NA   NA   NA   NA   NA   NA   NA 15.1
[337] 15.3 13.7   NA 15.4 14.6 16.4   NA   NA   NA 17.8   NA   NA   NA 14.2   NA 14.8
[353] 15.4   NA   NA   NA 14.9   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA
[369]   NA   NA
> min(f)
[1] NA
> b<-f[!is.na(f)]
> b
  [1] 16.1 16.3 15.7 17.4 15.7 12.9 17.4 18.1 16.0 16.4 15.4 21.6 14.5 16.1 15.1 17.4
 [17] 16.6 18.8 13.6 14.2 14.5 16.8 15.6 13.9 14.0 14.9 15.7 17.3 13.3 15.1 16.1 15.7
 [33] 16.3 15.3 15.5 18.7 16.2 14.6 15.2 15.8 14.6 15.5 16.2 17.2 14.0 15.7 16.9 14.9
 [49] 15.7 16.1 15.2 14.0 16.3 13.9 13.5 14.7 16.0 17.9 14.8 14.4 17.9 15.6 19.4 16.5
 [65] 17.2 15.0 14.3 15.7 17.3 15.6 13.1 16.9 14.9 13.9 16.2 14.7 15.0 14.3 17.0 16.0
 [81] 16.6 18.5 16.2 16.2 16.6 15.2 16.3 12.9 15.2 15.2 16.2 16.4 15.0 14.9 13.5 16.2
 [97] 17.7 17.5 17.2 16.6 15.5 16.5 16.4 16.1 16.3 17.2 16.0 14.5 16.4 14.7 16.7 17.1
[113] 15.9 15.4 17.1 16.2 14.1 16.1 18.9 12.4 16.0 17.2 16.3 15.8 15.4 16.8 15.2 16.3
[129] 14.4 18.0 16.7 16.5 16.2 13.3 15.5 17.1 17.6 14.3 14.8 15.3 16.6 18.7 18.1 15.6
[145] 15.9 15.5 15.8 15.2 14.3 14.9 12.0 16.1 17.7 15.2 16.6 15.6 17.2 13.6 16.1 14.5
[161] 15.5 14.7 16.2 17.7 14.9 15.9 14.6 16.8 15.7 15.2 13.1 16.8 16.1 14.9 13.8 15.2
[177] 16.2 15.6 14.0 15.2 17.1 15.7 15.0 16.0 16.5 15.1 15.3 13.7 15.4 14.6 16.4 17.8
[193] 14.2 14.8 15.4 14.9
> min(b)
[1] 12
Advertisements

About Lisa Cohen

PhD student at UC Davis.
This entry was posted in R. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s