HI,
This should also work:

 set.seed(5)
 list1<-lapply(1:3,function(i) 
data.frame(col1=sample(c(1:5,""),10,replace=TRUE), 
value=rnorm(10),stringsAsFactors=FALSE))

 lapply(list1,function(x) {x[x==""]<-NA;x})
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.

Reply via email to