Re: [R] Skipping missing files when importing data

2009-09-20 Thread Sundar Dorai-Raj
Try ?file.exists. if (file.exists(fxxx)) { read.table(fxxx) } else { cat("\"", fxxx, "\" is missing\n", sep = "") } HTH, --sundar On Sun, Sep 20, 2009 at 9:28 PM, jiangrm wrote: > Trying to import a bunch of data files named like f001, f002, f999. Some > of the files may be > missing

[R] Skipping missing files when importing data

2009-09-20 Thread jiangrm
Trying to import a bunch of data files named like f001, f002, f999. Some of the files may be missing and the missing files vary from time to time. Used for loop and read.table. When it reaches the missing file (say f100), it shows: Error in file(file, "r") : cannot open the connection In ad