Re: [R] Removing White spaces with NA

2014-04-04 Thread arun
Hi, Check if this works: n <- 1e7 dat <- data.frame(Col1=c("A", "", "B","C", "","","D",rep('',n)), stringsAsFactors=FALSE) dat2 <- dat dat[dat==''] <- NA which(dat$Col1=='') #integer(0) #or dat2$Col1[dat2$Col1==''] <- NA  which(dat2$Col1=='') #integer(0) A.K. On Wednesday, April 2,

Re: [R] Removing White spaces with NA

2014-04-02 Thread arun
Hi, May be this helps: dat <- data.frame(Col1=c("A", "", "B","C", "","","D"), stringsAsFactors=FALSE) is.na(dat) <- dat=='' dat$Col1 #[1] "A" NA "B" "C" NA NA "D" A.K. Hi All, I have a table and a column with values as below Col1 A B C D I need to replace the Empty cells with the value NA as