read.table terminates the program if the input file is empty. Is there
way to let the program continue and return me a NULL instead of
terminating the program?
$ Rscript read_empty.R
read.table(empty_data.txt)
Error in read.table(empty_data.txt) : no lines available in input
Execution halted
$
Please give reproducible example, more information on your
troubleshooting and sessionInfo(). Cannot reproduce:
pathname - empty.txt
cat(file=pathname)
print(file.info(pathname))
size isdir mode mtime ctime
empty.txt0 FALSE 666 2010-01-01 12:50:55
?try
On Fri, Jan 1, 2010 at 12:41 PM, Peng Yu pengyu...@gmail.com wrote:
read.table terminates the program if the input file is empty. Is there
way to let the program continue and return me a NULL instead of
terminating the program?
$ Rscript read_empty.R
read.table(empty_data.txt)
Error
Please reread my original post. You run it in a shell. I run it in a script.
On Fri, Jan 1, 2010 at 2:53 PM, Henrik Bengtsson h...@stat.berkeley.edu wrote:
Please give reproducible example, more information on your
troubleshooting and sessionInfo(). Cannot reproduce:
pathname - empty.txt
On Fri, Jan 1, 2010 at 2:54 PM, Dylan Beaudette
dylan.beaude...@gmail.com wrote:
?try
This works. Thank you!
f=try(read.table(empty_data.txt))
Error in read.table(empty_data.txt) : no lines available in input
if(class(f)=='try-error') {
+ f=NULL
+ }
print(f)
NULL
On Fri, Jan 1, 2010 at 3:19 PM, Peng Yu pengyu...@gmail.com wrote:
On Fri, Jan 1, 2010 at 2:54 PM, Dylan Beaudette
dylan.beaude...@gmail.com wrote:
?try
This works. Thank you!
f=try(read.table(empty_data.txt))
Error in read.table(empty_data.txt) : no lines available in input
One more
On Jan 1, 2010, at 4:42 PM, Peng Yu wrote:
On Fri, Jan 1, 2010 at 3:19 PM, Peng Yu pengyu...@gmail.com wrote:
On Fri, Jan 1, 2010 at 2:54 PM, Dylan Beaudette
dylan.beaude...@gmail.com wrote:
?try
This works. Thank you!
f=try(read.table(empty_data.txt))
Error in
?try()
On Fri, Jan 1, 2010 at 3:41 PM, Peng Yu pengyu...@gmail.com wrote:
read.table terminates the program if the input file is empty. Is there
way to let the program continue and return me a NULL instead of
terminating the program?
$ Rscript read_empty.R
read.table(empty_data.txt)
8 matches
Mail list logo