[R] how to skip from some null file and go on reading?
Jim Holtman
jholtman at gmail.com
Thu Jun 28 05:12:19 CEST 2012
why cann't you use 'try'?
you can get the size of the file with 'file.info' and then make a decision to read or not.
Sent from my iPad
On Jun 27, 2012, at 23:02, Jie Tang <totangjie at gmail.com> wrote:
> hi ,
> I am reading a series of files by the command shown as below.
> cop_x_data<-read.table(flnm(i)
> ,skip=2,allowEscapes=TRUE,blank.lines.skip=TRUE)
> the first two line of the files are headfile and I skip them by skip=2.
> and sometimes the data file is null and there is no any data
> in the file except for the head information.
> At this situation,my command would be in the error and tell me that
> there is not data in the file and can not go on.
> How can I skip out from the null file and go on reading the files while
> reading ?
>
> I can not use to try and tryCatch ,can anyone tell me ?
> thank you
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list