On Thu, Jan 19, 2012 at 10:31 PM, wang peter <wng.peter at gmail.com> wrote: > i have a vector >> start > [1] 4 5 6 NA > i want to replace NA by 1 > > but that didnot work > gsub(NA, 1, as.character(start), ignore.case = T) start[is.na(start)]=1