[R] remove particular elements in a vector

kevinchang shukai at seas.upenn.edu
Sat Sep 8 02:37:18 CEST 2007


Hi, 

Is there any build-in function allowing us to remove a particular group of
elements in a vector? 

For example, if I want to remove all the "NA" in the output of "answer"
function . Please help. Thanks

 answer(100) 
  [1]  1  2 NA  4 NA NA  7  8 NA NA 11 NA 13 14 NA 16 17 NA 19 NA NA 22 23
NA NA
 [26] 26 NA 28 29 NA 31 32 NA 34 NA NA 37 38 NA NA 41 NA 43 44 NA 46 47 NA
49 NA
 [51] NA 52 53 NA NA 56 NA 58 59 NA 61 62 NA 64 NA NA 67 68 NA NA 71 NA 73
74 NA
 [76] 76 77 NA 79 NA NA 82 83 NA NA 86 NA 88 89 NA 91 92 NA 94 NA NA 97 98
NA NA

-- 
View this message in context: http://www.nabble.com/remove-particular-elements-in-a-vector-tf4404489.html#a12565480
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list