[R] How to convert blanks to NA

Mark Na mtb954 at gmail.com
Tue Jun 2 21:14:00 CEST 2009


Hi R-helpers,

I have imported data from Excel using the following code:

library(xlsReadWrite)
data <- read.xls(data,colClasses=c("character"))

and this results in all of the empty (blank) cells in the imported
Excel file also being empty (blank) in the resulting dataframe.

I am not used to having blanks (rather NAs) and I think these are
caused by the colClasses argument.

I would like to convert all the empty (blank) cells in my dataframe to NA.

Thanks for any help you might provide.

Mark




More information about the R-help mailing list