Hi, Try this: set.seed(5) list1<-lapply(1:3,function(i) data.frame(col1=sample(c(1:5,""),10,replace=TRUE), value=rnorm(10),stringsAsFactors=FALSE)) res<-lapply(list1,function(x) {x[apply(x,2,function(y) y=="")]<-NA;x}) res[[1]] # col1 value #1 2 -0.6029080 #2 5 -0.4721664 #3 <NA> -0.6353713 #4 2 -0.2857736 #5 1 0.1381082 #6 5 1.2276303 #7 4 -0.8017795 #8 5 -1.0803926 #9 <NA> -0.1575344 #10 1 -1.0717600 A.K.
----- Original Message ----- From: Dominic Roye <dominic.r...@gmail.com> To: R help <r-help@r-project.org> Cc: Sent: Tuesday, January 8, 2013 7:16 AM Subject: [R] Logical operator and lists Hello R-Helpers, I have a slight problem with the expresion data[data==""] <- NA which works well for a data.frame. But now i must use the same for a list of data.frames. My idea is data[[]][data==""] but it don´t work. Thanks!! Dominic [[alternative HTML version deleted]] ______________________________________________ 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. ______________________________________________ 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.