Jie Tang
2012-Jun-12 02:06 UTC
[R] how to skip out and go on read while the read.table meet with a null file
hi ,R users I read a series of file by the command shown as below. cop_x_data<-read.table(flnm,skip=2) the first two line of the files are headfile and I skip them. and sometimes the original 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 go on read the files even if the file is null? thank you -- TANG Jie
David Winsemius
2012-Jun-12 02:16 UTC
[R] how to skip out and go on read while the read.table meet with a null file
On Jun 11, 2012, at 10:06 PM, Jie Tang wrote:> hi ,R users > I read a series of file by the command shown as below. > cop_x_data<-read.table(flnm,skip=2) > the first two line of the files are headfile and I skip them. > and sometimes the original 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 go on read the files even if the file is null?There are many examples in the archives that show how to recover from errors using 'tr'y and 'tryCatch'. -- David Winsemius, MD West Hartford, CT