Paul wrote:
> 
> Thanks for the responses. 'Try' seems to be the function that I needed. I
> had to adapt the code suggested below because vapply wasn't recognised,
> but this seemed to work:
>   x<‑lapply(a,function(x){try(read.table(x,colClasses='character'))})
> 

There is the risk with this approach that you could miss a real error in
your data (e.g. character in the wrong place, truncated). I would prefer to
use file.info to get the file size before I open it, and skip if too small.

Dieter

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Reading-multiple-text-files-where-some-files-are-empty-tp2401035p2403129.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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