?try()
On Fri, Jan 1, 2010 at 3:41 PM, Peng Yu 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 in re
On Jan 1, 2010, at 4:42 PM, Peng Yu wrote:
On Fri, Jan 1, 2010 at 3:19 PM, Peng Yu wrote:
On Fri, Jan 1, 2010 at 2:54 PM, Dylan Beaudette
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 mor
On Fri, Jan 1, 2010 at 3:19 PM, Peng Yu wrote:
> On Fri, Jan 1, 2010 at 2:54 PM, Dylan Beaudette
> 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 question. Is there a way to suppres
On Fri, Jan 1, 2010 at 3:03 PM, jim holtman wrote:
> ?try
>
> df <- try(read.table(...))
> if (inherits(df, 'try-error')){ what to do if file empty }
For the case of using try, it is better to use inherits() rather than
class(), or it doesn't matter?
> On Fri, Jan 1, 2010 at 3:55 PM, Ted Hardin
On Fri, Jan 1, 2010 at 2:54 PM, Dylan Beaudette
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
> g=try(read.table("data.txt"))
> print(g)
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 wrote:
> Please give reproducible example, more information on your
> troubleshooting and sessionInfo(). Cannot reproduce:
>
>> pathname <- "empty.txt"
>> cat(file=pathna
?try
df <- try(read.table(...))
if (inherits(df, 'try-error')){ what to do if file empty }
On Fri, Jan 1, 2010 at 3:55 PM, Ted Harding wrote:
> On 01-Jan-10 20:41:52, Peng Yu wrote:
> > read.table terminates the program if the input file is empty. Is there
> > way to let the program continue an
On 01-Jan-10 20:41:52, Peng Yu 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 in read.table("empty_data.t
?try
On Fri, Jan 1, 2010 at 12:41 PM, Peng Yu 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 in read.tab
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:
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
11 matches
Mail list logo