unction to raise error then one needs
another function on top of it).
Not sure why try doesn't work though.
best.
--- On Wed, 9/10/08, jim holtman <[EMAIL PROTECTED]> wrote:
From: jim holtman <[EMAIL PROTECTED]>
Subject: Re: [R] help: error handling in try
To: [EMAIL PROTECTE
}
> .Internal(seterrmessage(error.old));
> return(ret);
> }
>
> adate='12/2000';
> fun=as.Date;
> format='%b %Y';
>
> is.Date(adate,fun,format); # false
>
> library(zoo);
> fun=as.yearmon;
> format='%m/%Y';
>
t); # true
Cheer.
--- On Wed, 9/10/08, jim holtman <[EMAIL PROTECTED]> wrote:
From: jim holtman <[EMAIL PROTECTED]>
Subject: Re: [R] help: error handling in try
To: [EMAIL PROTECTED]
Cc: r-help@r-project.org
Date: Wednesday, September 10, 2008, 8:11 AM
Why don't you use 'try
Why don't you use 'try' in this fashion:
> f.error <- function(x) if (x == 1) stop('error')
>
> value <- try(f.error(1))
Error in f.error(1) : error
> if (inherits(value, 'try-error')) cat("Got this error:", value) else print
> ("no error")
Got this error: Error in f.error(1) : error
> value <- t
First time to post and searched archive for this problem with no clue. My
version is 2.5.1.
Below is a function to check if a given date is a valid date to a given date
function object. It uses try (also tried tryCatch but with same problem). When
given an invalid date, I am hoping try will gen
5 matches
Mail list logo