Re: [R] Matching and merging two rows with missing values

2007-10-11 Thread Iris Kolder
Thank you for your help this works!! x <-c("AA","AG","GG",NA, NA) y <- c(NA, "AG", "GG", "AA", NA) x[is.na(x)] <- y[is.na(x)] Hello, I have two rows which are almost identical but miss different values at different locations. I would like to merge these two rows so that the missing values

Re: [R] Matching and merging two rows with missing values

2007-10-11 Thread Dimitris Rizopoulos
try something like this: rw1 <- c("AA", "AG", "GG", NA, NA) rw2 <- c(NA, "AG", "GG", "AA", NA) ### rw <- rw1 rw[is.na(rw)] <- rw2[is.na(rw)] rw I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven