Skip to content
Back to formatted view

Raw Message

Message-ID: <366c6f341001011241u4be7e537u24dda530d62a85c8@mail.gmail.com>
Date: 2010-01-01T20:41:52Z
From: Peng Yu
Subject: How to not to terminate read.table if the input file is empty?

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
$ cat read_empty.R
read.table("empty_data.txt")
$ cat empty_data.txt; echo EOF
EOF