[R] Reading a file every t seg.

Marlon Martins dos Reis marlon at lscp.pqi.ep.usp.br
Mon Jul 28 20:08:10 CEST 2003


Dear all,
I'm writing a small program to read a file that receives data every time
(e.g. every 1second ). During the execution of my program I get the
message:
" Error in read.table("file.txt", header = T, sep = ";") :
        no lines available in input "
I suppose that it happens when I try to read the "file.txt" while it is
being written. To overcome this problem I have tried the following:

while(!is.numeric(try(read.table('file.txt',header =T, sep =
";")$tempo))){Sys.sleep(2)}

It seems to work, although after three times the message
" Error in read.table("file.txt", header = T, sep = ";") :
        no lines available in input "
is shown, the program stops.
Is there another way of checking if I can try to read a file?
Thanks in advance,
Reagrds,
Marlon !!!
marlon at lscp.pqi.ep.usp.br




More information about the R-help mailing list