apologies on the garbled posting, and thanks for the responses. This was perfect. Just to close the thread for others, here was my example data set: a<-c(NA,"China",NA,"Japan",NA,NA) b<-c("Honduras",NA,"Sudan",NA,"Mexico","Mexico") dfrm<-cbind(a,b) David's code was as follows: dfrm$b[is.na(dfrm$b)] <- dfrm$a[is.na(dfrm$b)] this works great. Thanks to you both On Fri, Sep 2, 2011 at 4:52 PM, David Winsemius wrote: > > On Sep 2, 2011, at 3:51 PM, Josh Tewksbury wrote: > > Hello, I have a dataframe that looks like this: >> >> a b NA Honduras China NA NA Sudan Japan NA NA Mexico NA Mexico >> I would like to replace the NA values in column b with the non-NA values >> in >> column a. I have tried a number of techniques, (if, ifelse) but I must >> have >> the logic wrong. >> > > Mangled data but no matter: > > dfrm$b[is.na(dfrm$b)] <- dfrm$a[is.na(dfrm$b)] > > (Learn to post in plain text. This is a plain text list.) > > > David Winsemius, MD > West Hartford, CT > > -- Joshua J. Tewksbury Walker Professor of Natural History, Department of Biology, University of Washington 106 Kincaid Hall, Box 351800 Seattle WA 98195-1800 my lab and office are in 528 Kincaid Hall cell phone 206/331-1893, office phone: 206/616-2129 lab phone: 206/616-2132, fax: 206/616-2011 website: http://faculty.washington.edu/tewksjj/index.html Please join the Natural History Network ( http://www.naturalhistorynetwork.org/) [[alternative HTML version deleted]]