Re: [R] How to convert blanks to NA

2009-06-03 Thread Hans-Peter Suter
2009/6/2 Mark Na : > 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. The pro version has an 'naStrings' argument. But this is something

Re: [R] How to convert blanks to NA

2009-06-02 Thread Henrique Dallazuanna
Try this: sapply(x, function(f){is.na(f)<-which(f == '');f}) On Tue, Jun 2, 2009 at 4:14 PM, Mark Na wrote: > 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 t

Re: [R] How to convert blanks to NA

2009-06-02 Thread John Kane
Does this do what you want x <- data.frame(1,"" , 5) x[x==""] <- NA x where x is substituted for your 'data'? - Original Message From: Mark Na To: r-help@r-project.org Sent: Tuesday, June 2, 2009 3:14:00 PM Subject: [R] How to convert blanks t

[R] How to convert blanks to NA

2009-06-02 Thread Mark Na
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 havi