I have a small Excel data file with two columns of character variables, one column with a numeric variable and three rows. One of the character cells is blank and one of the numeric cells is blank.
I read the data file with the following code: library(RODBC) channel <- odbcConnectExcel('u:/test.xls') sqlTables(channel) s1 <- sqlFetch(channel, "Sheet1") odbcClose(channel) s1 The code prints the data file as: Firstname Lastname Age 1 Bob Smith 20 2 John Clark NA 3 Andy <NA> 40 I can replace the NA with the number zero in the second row of the third (‘Age’) column using the following line: s1[is.na(s1[,3]), 3] <- 0 What code can I use to replace the <NA> in the third row of the second (‘Lastname’) column with qqqqqqqq? Thank you in advance for any advice. Mark Miller Gainesville, Florida ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.