Skip to content
Prev 306261 / 398506 Next

extract all data frames from a list & remove NAs

Hello,

You should have kept it in the R-Help list, the odds of having more 
answers would be greater.

There was a bug in the loop. It should be cleanDataSets[[i]] not 
cleanDataSets[i].
Anyway, I've simplified it a bit.


fls <- list.files(pattern = "*.csv")
files <- lapply(fls, read.csv, header=T)
good <- lapply(files, complete.cases)

cleanDataSets <- lapply(seq_along(fls), function(i) files[[i]][ 
good[[i]], ])


Hope this helps,

Rui Barradas

Em 25-09-2012 15:29, Dimitris r escreveu: